public virtual ActionResult Save(SectionViewModel model)
        {
            if (ModelState.IsValid)
            {
                var section = sectionService.Find(model.Id);

                if (section == null || !permissionService.IsAllowed((Int32)SectionOperations.Manage, this.CorePrincipal(), typeof(Section), section.Id, IsSectionOwner(section), PermissionOperationLevel.Object))
                {
                    throw new HttpException((int)HttpStatusCode.NotFound, HttpContext.Translate("Messages.NotFound", ResourceHelper.GetControllerScope(this)));
                }

                if (sectionService.Save(model.MapTo(section)))
                {
                    //save locale
                    var           localeService = ServiceLocator.Current.GetInstance <ISectionLocaleService>();
                    SectionLocale locale        = localeService.GetLocale(section.Id, model.SelectedCulture);
                    locale = model.MapLocaleTo(locale ?? new SectionLocale {
                        Section = section
                    });

                    localeService.Save(locale);

                    Success(HttpContext.Translate("Messages.Success", String.Empty));
                    return(RedirectToAction(WebContentMVC.Section.Edit(model.Id)));
                }
            }
            else
            {
                Error(HttpContext.Translate("Messages.ValidationError", String.Empty));
            }

            model.AllowManage = true;

            return(View("Edit", model));
        }
        public virtual ActionResult Save(SectionViewModel model)
        {
            if (ModelState.IsValid)
            {
                var section = sectionService.Find(model.Id);

                if (section == null || !permissionService.IsAllowed((Int32)SectionOperations.Manage, this.CorePrincipal(), typeof(Section), section.Id, IsSectionOwner(section), PermissionOperationLevel.Object))
                {
                    throw new HttpException((int)HttpStatusCode.NotFound, HttpContext.Translate("Messages.NotFound", ResourceHelper.GetControllerScope(this)));
                }

                if (sectionService.Save(model.MapTo(section)))
                {
                    //save locale
                    var localeService = ServiceLocator.Current.GetInstance<ISectionLocaleService>();
                    SectionLocale locale = localeService.GetLocale(section.Id, model.SelectedCulture);
                    locale = model.MapLocaleTo(locale ?? new SectionLocale { Section = section });

                    localeService.Save(locale);

                    Success(HttpContext.Translate("Messages.Success", String.Empty));
                    return RedirectToAction(WebContentMVC.Section.Edit(model.Id));
                }
            }
            else
            {
                Error(HttpContext.Translate("Messages.ValidationError", String.Empty));
            }

            model.AllowManage = true;

            return View("Edit", model);
        }