public void CrudFaqAddTest()
        {
            TranslateFAQPageModel model = new TranslateFAQPageModel();
            model.Question = RandomData.GetStringPersonFirstName();
            model.Answer = RandomData.GetStringPersonFirstName();
            model.Id = 0;

            int currentCount = this.faqTestModel.FaqTranslations.Count();

            this.helpLogic.CreateUpdateFAQ(model);
            this.callBackfaqTestModel.FaqTranslations.Count().Should().Be(currentCount + 1);

            this.dbContext.Verify(o => o.Update<Faq>(It.IsAny<Faq>()), Times.Once);
        }
        /// <summary>
        /// Method creates new or updates existing FAQ model and it childrens in db
        /// </summary>
        /// <param name="model">TranslateFAQPageModel object</param>
        public void CreateUpdateFAQ(TranslateFAQPageModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("FaqModel model is null");
            }
            var faqDb = this.DbContext.Get<Faq>(o => o.Id == model.FaqId);

            if (model.Id == 0 && !string.IsNullOrEmpty(model.Question) && !string.IsNullOrEmpty(model.Answer))
            {
                faqDb.FaqTranslations.Add(HelpSupportMapper.ToFaqTransDbObject(model));
            }

            if (model.Id > 0)
            {
                var tempModel = faqDb.FaqTranslations.Where(o => o.Id == model.Id).FirstOrDefault();
                tempModel.Question = model.Question;
                tempModel.Answer = model.Answer;
            }

            this.DbContext.Update<Faq>(faqDb);
        }
        public virtual ActionResult UpdateFAQ(TranslateFAQPageModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("Passed model (WebElementModel) is null");
            }

            this.HelpLogic.CreateUpdateFAQ(model);

            if (model.IsReturnBack)
            {
                string absoluteReturnUrl = this.Session["callerURL"].ToString();
                this.Session.Remove("callerURL");
                return base.RedirectBack(absoluteReturnLink: absoluteReturnUrl);
            }

            return this.RedirectToAction(MVC.Localization.FAQTranslationsByLanguage(model.FaqId, model.SelectedLanguage));
        }