private bool UpsertCity(EventAdministrationViewModel viewModel, out CityModel cityModelFromDb) { // Add city if it doesn't exist if (!string.IsNullOrWhiteSpace(viewModel.NewCity)) { cityModelFromDb = _cityRepository.GetCityByName(viewModel.NewCity.Trim()); if (cityModelFromDb == null) { cityModelFromDb = _cityRepository.AddNewCity(viewModel.NewCity); if (cityModelFromDb == null) { DisplayMessage(String.Format(" Failed to add new City '{0}'. Cannot Continue.", viewModel.NewCity)); return(false); } } } else { cityModelFromDb = _cityRepository.GetCityById(viewModel.CityId); } return(true); }