private void Add(object o)
 {
     int id = GridViewModel.OriginalItemsSource.Max(model => model.Id) + 1;
     var newItem = new CollectionItemModel { Id = id, Name = "Added item" };
     GridViewModel.ItemsSource.Add(newItem);
     GridViewModel.SelectedItem = newItem;
 }
 private async Task Remove(CollectionItemModel item)
 {
     if (item == null)
         item = GridViewModel.SelectedItem;
     if (await _messagePresenter.ShowAsync(string.Format("Delete {0} {1}?", item.Name, item.Id), "Delete", MessageButton.YesNo) == MessageResult.Yes)
     {
         GridViewModel.ItemsSource.Remove(item);
         GridViewModel.SelectedItem = null;
     }
 }
 private bool Filter(CollectionItemModel item)
 {
     if (string.IsNullOrEmpty(FilterText))
         return true;
     return item != null &&
            (item.Name.SafeContains(FilterText) ||
             item.Id.ToString(CultureInfo.InvariantCulture).SafeContains(FilterText));
 }
 private bool CanRemove(CollectionItemModel item)
 {
     return item != null || (GridViewModel != null && GridViewModel.SelectedItem != null);
 }