public async Task <ICommandResult> HandleAsync(ProjectIdentityDeleteCommand command, IAsyncCollector <ICommand> commandQueue, IDurableOrchestrationContext orchestrationContext, ILogger log) { if (command is null) { throw new ArgumentNullException(nameof(command)); } if (commandQueue is null) { throw new ArgumentNullException(nameof(commandQueue)); } var commandResult = command.CreateResult(); var projectIdentity = command.Payload; try { await graphService .DeleteServicePrincipalAsync(projectIdentity.Id) .ConfigureAwait(false); } catch (Exception exc) { commandResult.Errors.Add(exc, CommandErrorSeverity.Warning); } try { projectIdentity = await projectIdentityRepository .RemoveAsync(projectIdentity) .ConfigureAwait(false); commandResult.RuntimeStatus = CommandRuntimeStatus.Completed; } catch (Exception exc) { commandResult.Errors.Add(exc); } return(commandResult); }