private async void SetFavoriteCommandHandler(object obj) { var item = obj as ApiItem; try { // Set / remove favorite if (!item.IsFavorite) { await KryptPadApi.AddItemToFavoritesAsync(item); } else { await KryptPadApi.DeleteItemFromFavoritesAsync(item); } } catch (WebException ex) { // Something went wrong in the api await DialogHelper.ShowMessageDialogAsync(ex.Message); } catch (Exception ex) { // Failed await DialogHelper.ShowGenericErrorDialogAsync(ex); } }