public async Task <int> Handle(CreateTravelCommand request, CancellationToken cancellationToken)
        {
            var    user = _travelDbContext.Users.Find(request.UserId);
            Travel travel;
            EntityEntry <Travel> result;

            if (user == null)
            {
                travel = new Travel(request.Name, request.Description, new User(request.UserId, request.Email));
                result = await _travelDbContext.Travels.AddAsync(travel, cancellationToken);

                await _travelDbContext.SaveChangesAsync(cancellationToken);

                await _sendGridService.SendToSingleRecipientAsync(TEST_EMAIL, TEST_EMAIL,
                                                                  request.Name, string.Empty, request.Description);

                return(result.Entity.Id);
            }
            user.ChangeEmail(request.Email);
            travel = new Travel(request.Name, request.Description, user);
            result = await _travelDbContext.Travels.AddAsync(travel, cancellationToken);

            await _travelDbContext.SaveChangesAsync(cancellationToken);

            await _sendGridService.SendToSingleRecipientAsync(TEST_EMAIL, TEST_EMAIL,
                                                              request.Name, string.Empty, request.Description);

            return(result.Entity.Id);
        }
        public async Task <int> Handle(UpdateTravelDescriptionCommand request, CancellationToken cancellationToken)
        {
            var travel = await _travelDbContext.Travels.FindAsync(request.Id);

            if (travel == null)
            {
                throw new ApplicationException(NO_TRAVEL);
            }

            var user = await _travelDbContext.Users.FindAsync(request.UserId) ?? new User(request.UserId, request.Email);

            if (request.IsAdmin || travel.CreatedBy.Id == request.UserId)
            {
                travel.ChangeDescription(request.Description, user);
            }

            await _travelDbContext.SaveChangesAsync(cancellationToken);

            return(request.Id);
        }