/// <summary>
        /// Adds the or update to database.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="parentName">Name of the parent.</param>
        /// <param name="topicName">Name of the topic.</param>
        /// <param name="longTitle">The long title.</param>
        /// <param name="description">The description.</param>
        /// <param name="consumerLongTitle">The consumer long title.</param>
        /// <param name="consumerDescription">The consumer description.</param>
        /// <param name="categoryType">Type of the category.</param>
        /// <param name="topicFacts1Text">The topic facts1 text.</param>
        /// <param name="topicFacts1Citation">The topic facts1 citation.</param>
        /// <param name="topicFacts1Image">The topic facts1 image.</param>
        /// <param name="topicFacts2Text">The topic facts2 text.</param>
        /// <param name="topicFacts2Citation">The topic facts2 citation.</param>
        /// <param name="topicFacts2Image">The topic facts2 image.</param>
        /// <param name="topicFacts3Text">The topic facts3 text.</param>
        /// <param name="topicFacts3Citation">The topic facts3 citation.</param>
        /// <param name="topicFacts3Image">The topic facts3 image.</param>
        /// <param name="tipsChecklist">The tips checklist.</param>
        /// <param name="topicIcon">The topic icon.</param>
        private void AddOrUpdateToDB(ISession session, string parentName, string topicName, string longTitle, string description, string consumerLongTitle, string consumerDescription, string categoryType,
                                     string topicFacts1Text, string topicFacts1Citation, string topicFacts1Image,
                                     string topicFacts2Text, string topicFacts2Citation, string topicFacts2Image,
                                     string topicFacts3Text, string topicFacts3Citation, string topicFacts3Image,
                                     string tipsChecklist, string topicIcon)
        {
            try
            {
                //  Get the TopicCategory object if exist; otherwise create it.
                var cat = session.Query <TopicCategory>().FirstOrDefault(tc => tc.Name == parentName) ?? new TopicCategory(parentName);

                //  If topicName is empty we are only creating/updating a TopicCategory.
                if (string.IsNullOrWhiteSpace(topicName))
                {
                    cat.Description         = description;
                    cat.LongTitle           = longTitle;
                    cat.ConsumerDescription = consumerDescription;
                    cat.Facts = new List <TopicFacts>();

                    if (StringExtensions.AnyPopulated(topicFacts1Text, topicFacts1Citation, topicFacts1Image))
                    {
                        cat.Facts.Add(new TopicFacts()
                        {
                            Name = "Fact1", Text = topicFacts1Text, CitationText = topicFacts1Citation, ImagePath = topicFacts1Image
                        });
                    }
                    if (StringExtensions.AnyPopulated(topicFacts2Text, topicFacts2Citation, topicFacts2Image))
                    {
                        cat.Facts.Add(new TopicFacts()
                        {
                            Name = "Fact2", Text = topicFacts2Text, CitationText = topicFacts2Citation, ImagePath = topicFacts2Image
                        });
                    }
                    if (StringExtensions.AnyPopulated(topicFacts3Text, topicFacts3Citation, topicFacts3Image))
                    {
                        cat.Facts.Add(new TopicFacts()
                        {
                            Name = "Fact3", Text = topicFacts3Text, CitationText = topicFacts3Citation, ImagePath = topicFacts3Image
                        });
                    }

                    cat.TipsChecklist = tipsChecklist;
                    cat.TopicIcon     = topicIcon;

                    if (!string.IsNullOrEmpty(categoryType))
                    {
                        cat.CategoryType = EnumExtensions.GetEnumValueFromString <TopicCategoryTypeEnum>(categoryType);
                    }
                }
                //  Create/Update the topic
                else
                {
                    var topic = session.Query <Topic>().FirstOrDefault(t => t.Name.ToLower().Equals(topicName.ToLower()) &&
                                                                       t.Owner.Name.ToLower().Equals(parentName.ToLower())) ?? new Topic(cat, topicName);

                    topic.Description       = description;
                    topic.LongTitle         = longTitle;
                    topic.ConsumerLongTitle = consumerLongTitle;

                    session.SaveOrUpdate(topic);
                }
                session.SaveOrUpdate(cat);
            }
            catch (Exception ex)
            {
                Logger.Write(ex, "Error inserting or updating database record for measure topic");
            }
        }