protected async void DeleteFieldCommandHandler(object p) { // Get data context var field = p as FieldModel; // Prompt user to delete the field var promptResp = await DialogHelper.Confirm( "This action cannot be undone. Are you sure you want to delete this field?", async (c) => { try { // Call api to delete the field from the item await KryptPadApi.DeleteFieldAsync(Category.Id, Item.Id, field.Id); // Remove the field Fields.Remove(field); } catch (WebException ex) { // Something went wrong in the api await DialogHelper.ShowMessageDialogAsync(ex.Message); } catch (Exception ex) { // Failed await DialogHelper.ShowGenericErrorDialogAsync(ex); } }); }