public ActionResult Create(BranchModel model, bool continueEditing)
        {
            if (ModelState.IsValid)
            {
                var branch = model.ToEntity();
                branch.CreatedOnUtc = DateTime.UtcNow;
                _branchService.InsertBranch(branch);

                //search engine name
                model.SeName = branch.ValidateSeName(model.SeName, branch.Title, true);
                _urlRecordService.SaveSlug(branch, model.SeName, 0);

                //locales
                UpdateLocales(branch, model);
                _branchService.UpdateBranch(branch);

                SuccessNotification(_localizationService.GetResource("Toi.Plugin.Misc.Branches.Branch.Added"));
                return continueEditing ? RedirectToAction("Edit", new { id = branch.Id }) : RedirectToAction("List");
            }
            //parent branchGroups
            model.BranchGroups = new List<DropDownItem> { new DropDownItem { Text = "[None]", Value = "0" } };
            if (model.BranchGroupId > 0)
            {
                var parentBranchGroup = _branchService.GetBranchGroupById(model.BranchGroupId);
                if (parentBranchGroup != null && !parentBranchGroup.Deleted)
                    model.BranchGroups.Add(new DropDownItem { Text = parentBranchGroup.GetFormattedBreadCrumb(_branchService), Value = parentBranchGroup.Id.ToString() });
                else
                    model.BranchGroupId = 0;
            }
            return View(model);
        }
        public ActionResult Edit(BranchModel model, bool continueEditing)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageNews))
                return AccessDeniedView();

            var branch = _branchService.GetBranchById(model.Id);
            if (branch == null)
                //No news item found with the specified id
                return RedirectToAction("List");

            if (ModelState.IsValid)
            {
                branch = model.ToEntity(branch);
                _branchService.UpdateBranch(branch);

                //search engine name
                model.SeName = branch.ValidateSeName(model.SeName, branch.Title, true);
                _urlRecordService.SaveSlug(branch, model.SeName, 0);

                //locales
                UpdateLocales(branch, model);
                _branchService.UpdateBranch(branch);

                SuccessNotification(_localizationService.GetResource("Toi.Plugin.Misc.Branches.Branch.Updated"));
                return continueEditing ? RedirectToAction("Edit", new { id = branch.Id }) : RedirectToAction("List");
            }
            PrepareBranchModel(model);
            //parent branchGroups
            model.BranchGroups = new List<DropDownItem> { new DropDownItem { Text = "[None]", Value = "0" } };
            if (model.BranchGroupId > 0)
            {
                var parentBranchGroup = _branchService.GetBranchGroupById(model.BranchGroupId);
                if (parentBranchGroup != null && !parentBranchGroup.Deleted)
                    model.BranchGroups.Add(new DropDownItem { Text = parentBranchGroup.GetFormattedBreadCrumb(_branchService), Value = parentBranchGroup.Id.ToString() });
                else
                    model.BranchGroupId = 0;
            }
            return View(model);
        }