public ActionResult ProviderSites(ProviderSiteSearchViewModel viewModel) { var response = _adminMediator.SearchProviderSites(viewModel); ModelState.Clear(); switch (response.Code) { case AdminMediatorCodes.SearchProviderSites.FailedValidation: response.ValidationResult.AddToModelState(ModelState, "SearchViewModel"); return(View(response.ViewModel)); case AdminMediatorCodes.SearchProviderSites.Ok: return(View(response.ViewModel)); default: throw new InvalidMediatorCodeException(response.Code); } }