public void WhenInstantiatingClassWithDefaultConstructor_Edit_Succeeds()
        {
            // Arrange
            CmsPageManagerEditViewModel model;

            // Act
            model = new CmsPageManagerEditViewModel();

            // Assert
            Assert.NotNull(model);
        }
        public ActionResult Edit(string cancel, string delete, string save, string updateParts, string publish, CmsPageManagerEditViewModel viewModel)
        {
            CmsPageManagerServiceBinder modelBinder = this.GetServiceBinder();

            if (this.ModelState.IsValid)
            {
                if (save != null  || publish != null)
                {
                    if (publish != null)
                    {
                        viewModel.IsPublished = true;
                    }

                    viewModel.LastModifiedBy = User.Identity.Name;
                    viewModel = modelBinder.EditViewModelUpdate(viewModel);
                }

                if (delete != null)
                {
                    viewModel = modelBinder.EditViewModelDelete(viewModel);

                    if (viewModel.ActionIsDeleteSuccessful != null && (bool)viewModel.ActionIsDeleteSuccessful)
                    {
                        return this.Redirect(WebAdmin.AdminPageList);
                    }
                }

                if (updateParts != null)
                {
                    viewModel = modelBinder.EditViewModelUpdate(viewModel);
                }
            }
            else
            {
                //// Okay there has been an error as the ModelState is inValid, chances are they have not completed the form all in
                //// however, we may now also be missing other data such as select lists
                viewModel = modelBinder.EditViewModelStateInValid(viewModel);
                this.ModelState.AddModelError("pants", "Failed to submit. Correct any errors");

                //// this will display if validation fails to pass
            }

            //// TODO: [RP] [170612] Correctly handling edit screens on success and failures
            //// After reviewing Wordpress I think the save action should result in the user staying on the current view
            return View(viewModel);
        }