public virtual ActionResult Resources(WebElementModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model", "Passed model (WebElementModel) is null");
            }

            this.LocalEditor.SaveResources(model);

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

            return this.RedirectToAction(MVC.Localization.Resources(model.ModelName, model.PropertyName, model.SelectedLanguage));
        }
        public void Setup()
        {
            this.WebElem = new WebElement();
            this.WebElementTrans = new WebElementTranslation();

            this.WebElemModel = new WebElementModel();
            this.WebElemModelTrans = new WebElementTranslationModel();
        }
        /// <summary>
        /// Maps Db Resource object to ViewModel Resource object
        /// </summary>
        /// <param name="input">Db  Resource object</param>
        /// <param name="selectedLang">Language to load ViewModel for</param>
        /// <returns>ViewModel Resource object</returns>
        public static WebElementModel ToWebModel(this WebElement input, esrvModel.SupportedLanguage selectedLang)
        {
            if (input == null)
            {
                return null;
            }

            var model = new WebElementModel
            {
                ModelName = input.ModelName,
                PropertyName = input.PropertyName,
                WebElementId = input.WebElementId,
                SelectedLanguage = selectedLang,
                LanguageToSave = selectedLang,
                IsReturnBack = true
            };
            if (input.WebElementTranslations == null)
            {
                return model;
            }

            var translations = input.WebElementTranslations.Where(t => (byte)t.Language == (byte)selectedLang).ToList();
            if (translations.Count > 0)
            {
                foreach (WebElementTranslation webElementTranslation in translations)
                {
                    switch (webElementTranslation.TranslationType)
                    {
                        case dbObj.TranslatedTextType.Label:
                            model.PropertyLabel = webElementTranslation.TranslatedText;
                            break;
                        case dbObj.TranslatedTextType.SubLabel:
                            model.PropertySubLabel = webElementTranslation.TranslatedText;
                            break;
                        case dbObj.TranslatedTextType.ControlText:
                            model.PropertyHint = webElementTranslation.TranslatedText;
                            break;
                        case dbObj.TranslatedTextType.HelpText:
                            model.PropertyHelp = webElementTranslation.TranslatedText;
                            break;
                        case dbObj.TranslatedTextType.EnumText:
                            model.PropertyEnum = webElementTranslation.TranslatedText;
                            break;
                    }
                }
            }

            return model;
        }