public static async Task RunOrchestration(
            [OrchestrationTrigger] IDurableOrchestrationContext functionContext,
            ILogger log)
        {
            if (functionContext is null)
            {
                throw new ArgumentNullException(nameof(functionContext));
            }

            if (log is null)
            {
                throw new ArgumentNullException(nameof(log));
            }

            var command       = functionContext.GetInput <OrchestratorProjectDeleteCommand>();
            var commandResult = command.CreateResult();

            using (log.BeginCommandScope(command))
            {
                functionContext.SetCustomStatus($"Refreshing project", log);

                var project = commandResult.Result = (await functionContext
                                                      .GetProjectAsync(command.ProjectId.GetValueOrDefault(), allowUnsafe: true)
                                                      .ConfigureAwait(true)) ?? command.Payload;

                try
                {
                    try
                    {
                        functionContext.SetCustomStatus("Sending commands", log);

                        var providerResults = await functionContext
                                              .SendCommandAsync <ProviderProjectDeleteCommand, ProviderProjectDeleteCommandResult>(new ProviderProjectDeleteCommand(command.User, project, command.CommandId))
                                              .ConfigureAwait(true);
                    }
                    finally
                    {
                        functionContext.SetCustomStatus("Deleting project", log);

                        await functionContext
                        .CallActivityWithRetryAsync(nameof(ProjectDeleteActivity), project)
                        .ConfigureAwait(true);

                        functionContext.SetCustomStatus("Deleting resources", log);

                        await functionContext.DeleteResourcesAsync
                        (
                            false, // we are not going to wait for this operation
                            GetResourceGroupId(project?.ResourceGroup?.ResourceGroupId),
                            GetResourceGroupId(project?.KeyVault?.VaultId)
                        )
                        .ConfigureAwait(true);
                    }
                }
                catch (Exception exc)
                {
                    commandResult ??= command.CreateResult();
                    commandResult.Errors.Add(exc);

                    throw;
                }
                finally
                {
                    var commandException = commandResult.Errors?.ToException();

                    if (commandException is null)
                    {
                        functionContext.SetCustomStatus($"Command succeeded", log);
                    }
                    else
                    {
                        functionContext.SetCustomStatus($"Command failed: {commandException.Message}", log, commandException);
                    }

                    functionContext.SetOutput(commandResult);
                }
            }
        }