public async Task <Guid> Handle(CriarComandaCommand request, CancellationToken cancellationToken) { var comanda = new Comanda(request.NumeroComanda); if (_comandaRepository.PossuiNumeroComandaCadastrada(comanda)) { comanda.AddNotification("Comanda.Numero", "O numero da comanda ja esta cadastrado no banco."); } if (comanda.Invalid) { await _mediator.Publish(new DomainNotification { Erros = comanda.Notifications }, cancellationToken); return(await Task.FromResult(Guid.Empty)); } _comandaRepository.Add(comanda); return(await Task.FromResult(comanda.Id)); }