private void DeleteMeasure(Object measure) { dbActions = new DbActions(); if (selectedMeasure != null) { if (MessageBox.Show("Do you want to delete the selected measure?", "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes) { if (dbActions.DeleteMeasure(new CookBookData.Model.Measure { Id = selectedMeasure.Id })) { measureItems.Remove(selectedMeasure); } } } }