private async Task SendRecipeAsync() { Task task; if (EditMode) { task = APIConsumer.UpdateRecipeAsync(new UpdateRecipeDto() { Title = Title, Description = Description, RecipeID = Recipe.RecipeID }); } else { task = APIConsumer.SendNewRecipeAsync(new NewRecipeDto() { Title = Title, Description = Description, ParentAncestryPath = Recipe?.AncestryPath }); } await task; if (task.IsCompletedSuccessfully && !EditMode) { if (Recipe is null) { RootLevelUpdated?.Invoke(null, null); } else { Recipe.LoadChildrenCommand.Execute(null); } } else if (task.IsCompletedSuccessfully && EditMode) { Recipe.Title = Title; Recipe.Description = Description; EditMode = false; } CloseEditorCommand.Execute(null); }