public ActionResult Edit()
        {
            CheckIfSiteAdmin();

            var staticContentViewModel = new StaticContentViewModel();
            return View("Save", staticContentViewModel);
        }
        public ActionResult Edit(StaticContentType contentType)
        {
            CheckIfSiteAdmin();

            var staticContentViewModel = new StaticContentViewModel();
            var staticContent = _staticContentService.GetStaticContent(contentType);
            staticContentViewModel.Content = staticContent.Content;

            try
            {
                // Format the HTML returned by Telerik control so that indented HTML will be shown in HTML editor.
                staticContentViewModel.Content = XElement.Parse(staticContentViewModel.Content).ToString();
            }
            catch (XmlException)
            {
                try
                {
                    // In case if the HTML doesn't have a root, add a <p> tag as wrapper.
                    staticContentViewModel.Content = XElement.Parse(string.Format(CultureInfo.CurrentCulture, "<p>{0}</p>", staticContentViewModel.Content)).ToString();
                }
                catch (XmlException)
                {
                    // Consume any other Xml exception with parsing and try to load the string as is.
                    // There could be problem like the text is not a valid XML.
                }
            }

            return View("Save", staticContentViewModel);
        }
        public ActionResult Save(StaticContentViewModel staticContentViewModel)
        {
            CheckIfSiteAdmin();

            // Make sure staticContentViewModel is not null
            this.CheckNotNull(() => new { staticContentViewModel });
            if (ModelState.IsValid)
            {
                var staticContent = new StaticContentDetails()
                {
                    TypeID = staticContentViewModel.ContentType,
                    Content = staticContentViewModel.Content,
                    ModifiedByID = CurrentUserId
                };

                var status = _staticContentService.UpdateStaticContent(staticContent);
                if (!status.Succeeded)
                {
                    throw new Exception(status.ErrorMessage, status.Exception);
                }

                switch (staticContentViewModel.ContentType)
                {
                    case (int)StaticContentType.HomePageHelpText:
                        return RedirectToAction("Index", "Home");
                    case (int)StaticContentType.FAQ:
                        return RedirectToAction("FAQs", "Home");
                    case (int)StaticContentType.WWTInstall:
                        return RedirectToAction("InstallWWT", "Home");
                    case (int)StaticContentType.ExcelInstall:
                        return RedirectToAction("ExcelAddInWelcome", "Home");
                    case (int)StaticContentType.ExcelHelp:
                        return RedirectToAction("ExcelAddInHelp", "Home");
                    case (int)StaticContentType.LearnMore:
                        return RedirectToAction("LearnMore", "Home");
                    case (int) StaticContentType.GetStarted:
                        return RedirectToAction("GetStarted", "Home");
                    case (int)StaticContentType.VisualizingContentinWWT:
                        return RedirectToAction("VisualizingContentinWWT", "Home");
                    case (int)StaticContentType.Narwhal:
                        return RedirectToAction("Narwhal", "Home");
                    case (int)StaticContentType.WWTAddinForExcel:
                        return RedirectToAction("WWTAddinForExcel", "Home");
                    default:
                        return RedirectToAction("Index", "Admin");
                }
            }
            else
            {
                // In case of any validation error stay in the same page.
                staticContentViewModel.Content = Server.HtmlDecode(staticContentViewModel.Content);
                return View("Save", staticContentViewModel);
            }
        }