private void OnStorageCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: foreach (var item in e.NewItems) { var model = item as NetworksStorageModel; Storages.Add(model.GetViewModel()); } break; case NotifyCollectionChangedAction.Remove: foreach (var item in e.OldItems) { var model = item as NetworksStorageModel; Storages.Remove(Storages.First(s => s.Id == model.Id.ToString())); } break; } }