private async Task UpdateList(RecordChangedEventArgs <Station> e) { if (e.ChangeType == ChangeType.None) { return; } if (e.ChangeType == ChangeType.Delete) { var s = StationList.FirstOrDefault(c => c.Model.StationId == e.Entity.StationId); if (s == null) { return; } StationList.Remove(s); } else if (e.ChangeType == ChangeType.Insert) { StationList.Add(new StationModel(e.Entity, _repository)); } else if (e.ChangeType == ChangeType.Update) { var s = StationList.FirstOrDefault(c => c.Model.StationId == e.Entity.StationId); if (s == null) { return; } var i = StationList.IndexOf(s); StationList[i] = new StationModel(e.Entity, _repository); SelectedStation = StationList[i]; } }