/// <summary>
        /// Updates a topic from a markdown document
        /// </summary>
        /// <param name="doc">document to update from (from disk)</param>
        /// <param name="topic">topic to update</param>
        public void UpdateTopicFromMarkdown(MarkdownDocument doc, DocTopic topic, bool noBody = false)
        {
            var fileTopic = new DocTopic();

            fileTopic.Project     = this;
            fileTopic.DisplayType = string.Empty;
            fileTopic.Type        = null;
            fileTopic.LoadTopicFile(doc.Filename); // make sure we have latest


            if (!string.IsNullOrEmpty(fileTopic.Title))
            {
                topic.Title = fileTopic.Title;
            }

            if (!string.IsNullOrEmpty(fileTopic.Slug))
            {
                topic.Slug = fileTopic.Slug;
            }

            if (!string.IsNullOrEmpty(fileTopic.Link))
            {
                topic.Link = fileTopic.Link;
            }

            // TODO: Figure out how we can detect whether this has changed or is the default
            //       Problem is that DisplayType gets set to a default if n
            if (!string.IsNullOrEmpty(fileTopic.DisplayType))
            {
                topic.DisplayType = fileTopic.DisplayType;
            }


            if (!string.IsNullOrEmpty(fileTopic.Type))
            {
                topic.Type = fileTopic.Type;
            }



            if (!noBody)
            {
                topic.Body = fileTopic.Body;
            }
        }
        /// <summary>
        /// Common code that performs after topic loading logic
        /// </summary>
        /// <param name="topic"></param>
        /// <returns></returns>
        protected DocTopic AfterTopicLoaded(DocTopic topic)
        {
            if (topic == null)
            {
                Topic = null;
                SetError("Topic not found.");
            }

            topic.Project = this;

            topic.TopicState.IsDirty = false;
            topic.TopicState.OldLink = null;
            topic.TopicState.OldSlug = null;

            if (!topic.LoadTopicFile()) // load disk content
            {
                SetError("Topic body content not found.");
                return(null);
            }

            return(topic);
        }