public async Task HandleAsync(DeleteIssue command) { var issue = await _issueRepository.GetAsync(command.IssueId); if (issue is null) { throw new IssueNotFoundException(command.IssueId); } if (!await _projectsApiHttpClient.HasPermission(IssuePermissionKeys.DeleteIssues, _appContext.Identity.Id, issue.ProjectId)) { throw new ActionNotAllowedException(); } await _issueRepository.DeleteAsync(issue.Id); _logger.LogInformation($"Deleted issue with id: {issue.Id}."); await _messageBroker.PublishAsync(new IssueDeleted(issue.Id, issue.ProjectId)); }