public async Task <CommandResponse> Handle(ExcluirPerfilCommand request, CancellationToken cancellationToken) { if (!await PerfilExitente(request)) { return(await Task.FromResult(CommandResponse.Fail)); } var perfil = await _perfilRepository.ObterComPermissoesAsync(request.Id); if (!await _domainService.DeletarPerfilAsync(perfil)) { return(await Task.FromResult(CommandResponse.Fail)); } if (await Commit()) { await _mediator.Publish(new PerfilDeletadoEvent(perfil)); } return(await Task.FromResult(CommandResponse.Ok)); }