public Task <bool> Handle(TicketUpdateCommand message, CancellationToken cancellationToken)
        {
            if (!message.IsValid())
            {
                NotifyValidationErrors(message);
                return(Task.FromResult(false));
            }

            var customer         = new Customer(message.Id, message.Name, message.Email, message.BirthDate);
            var existingCustomer = _customerRepository.GetByEmail(customer.Email);

            if (existingCustomer != null && existingCustomer.Id != customer.Id)
            {
                if (!existingCustomer.Equals(customer))
                {
                    Bus.RaiseEvent(new DomainNotification(message.MessageType, "The customer e-mail has already been taken."));
                    return(Task.FromResult(false));
                }
            }

            _customerRepository.Update(customer);

            if (Commit())
            {
                Bus.RaiseEvent(new CustomerUpdatedEvent(customer.Id, customer.Name, customer.Email, customer.BirthDate));
            }

            return(Task.FromResult(true));
        }
        public bool Update(TicketUpdateCommand ticket)
        {
            var ticketDb = TicketRepository.GetById(ticket.Id);

            if (ticketDb == null)
            {
                throw new NotFoundException("Registro não encontrado!");
            }

            var userEdit = Mapper.Map(ticket, ticketDb);

            return(TicketRepository.Update(userEdit));
        }