public ActionResult SaveProviderUser(ProviderUserViewModel viewModel) { var response = _adminMediator.SaveProviderUser(viewModel); ModelState.Clear(); SetUserMessage(response.Message); switch (response.Code) { case AdminMediatorCodes.SaveProviderUser.FailedValidation: response.ValidationResult.AddToModelState(ModelState, "SearchViewModel"); return(View("ProviderUser", response.ViewModel)); case AdminMediatorCodes.SaveProviderUser.Error: return(RedirectToRoute(RecruitmentRouteNames.AdminViewProviderUser, new { viewModel.ProviderUserId })); case AdminMediatorCodes.SaveProviderUser.Ok: return(RedirectToRoute(RecruitmentRouteNames.AdminViewProviderUser, new { viewModel.ProviderUserId })); default: throw new InvalidMediatorCodeException(response.Code); } }