public ActionResult Create(AppointmentsPageModel pageModel) { bool?succeeded = null; var newModel = pageModel.NewAppoitmentModel; var userData = Session["UserData"] as UserData; ModelState.Clear(); if (ModelState.IsValid) { succeeded = _appointmentsRepository.Create(newModel, userData); } else { return(new BsJsonResult( new Dictionary <string, object> { { "Errors", ModelState.GetErrors() } }, BsResponseStatus.ValidationError)); } return(Redirect(Url.Action("Index", "Appointments"))); }