public void InsertChapter(List <EpubItem> chapters, EpubItem insertAt) { for (int i = 0; i < Manifest.Count; ++i) { if (insertAt == Manifest[i]) { for (int j = 0; j < chapters.Count; ++j) { Manifest.Insert(i + j, chapters[j]); } break; } } for (int i = 0; i < Spine.Count; ++i) { if (insertAt == Spine[i]) { for (int j = 0; j < chapters.Count; ++j) { Spine.Insert(i + j, chapters[j]); } break; } } for (int j = 0; j < chapters.Count; ++j) { var chapter = chapters[j]; AbsolutePathIndex.Add(chapter.AbsolutePath, chapter); IdIndex.Add(chapter.Id, chapter); } }