I would suggest compiling a master list that could be inserted as it builds.

This may go dozens of pages