private void CommitEdit() { if (ItemsView.IsEditingItem && !((TViewModel)ItemsView.CurrentEditItem).HasErrors) { ItemsView.CommitEdit(); } else if (ItemsView.IsAddingNew && !((TViewModel)ItemsView.CurrentAddItem).HasErrors) { ItemsView.CommitNew(); } }