private TopicTree FixLinks(TopicTree tree) { Topic previous = null; foreach (var section in tree.Sections) { section.Tree = tree; foreach (var topic in section.Topics) { if (topic.HasContent) { if (previous != null) { topic.Previous = previous; previous.Next = topic; } previous = topic; } } } return tree; }