public void Save(Stream stream) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } using (var writer = new BioCodexMapWriter(stream)) { // Sections writer.Write(Sections.Count); foreach (var section in Sections) { writer.Write(section.Key); writer.Write(section.Value); } // Pages writer.Write(Pages.Count); foreach (var page in Pages) { writer.Write(page.Key); writer.Write(page.Value); } } }