/// <summary> /// Refreshes this instance. /// </summary> public void Refresh() { var configService = ServiceLocator.Current.GetInstance <IConfigurationService>(); ReferenceExists = !IsInitialMapping; CurrentMappingBasis = configService.HospitalRegion; if (SelectedStates != null) { SelectedStates.OfType <SelectListItem>().ToList().ForEach(OnRemoveStateCommand); } RaisePropertyChanged(() => SelectedStates); CurrentMappingBasis.DefaultStates .OfType <string>() .ToList() .ForEach(ab => { var toAdd = AvailableStates.OfType <SelectListItem>().FirstOrDefault(kvp => kvp.Value != null && kvp.Value.ToString().EqualsIgnoreCase(ab)); if (toAdd != null) { AddStateToContext(toAdd); } }); RaisePropertyChanged(() => AvailableStates); SelectedRegionType = CurrentMappingBasis.SelectedRegionType ?? typeof(object); RaisePropertyChanged(() => SelectedRegionType); }