public async Task <LocationDTO> EditLocationInfo(LocationEditDTO locationInfo)
        {
            using (_unitOfWork)
            {
                if (!DateManagerService.checkFromToDates(locationInfo.From, locationInfo.To))
                {
                    return(null);
                }

                Location location = await _unitOfWork.LocationRepository.GetLocationWithAccommodations(locationInfo.LocationId);

                if (location.Accommodations != null)
                {
                    foreach (Accommodation accommodation in location.Accommodations)
                    {
                        if (!DateManagerService.checkParentChildDates(locationInfo.From, locationInfo.To, accommodation.From, accommodation.To))
                        {
                            return(null);
                        }
                    }
                }

                Trip trip = await _unitOfWork.TripRepository.FindByID(location.TripId);

                location.Name        = locationInfo.Name;
                location.Description = locationInfo.Description;
                location.From        = locationInfo.From;
                location.To          = locationInfo.To;

                if (!DateManagerService.checkParentChildDates(trip.From, trip.To, location.From, location.To))
                {
                    return(null);
                }

                await _unitOfWork.Save();

                LocationDTO retValue = _mapper.Map <Location, LocationDTO>(location);
                await _messageControllerService.NotifyOnTripChanges(location.TripId, "EditLocation", retValue);

                return(retValue);
            }
        }
        public async Task <ActionResult> EditLocation(int tripId, [FromBody] LocationEditDTO locationInfo)
        {
            try
            {
                if (!await _editRightsService.HasEditRights(tripId))
                {
                    return(BadRequest(new JsonResult("You can't currently edit this trip.")));
                }
                LocationDTO result = await _locationService.EditLocationInfo(locationInfo);

                await _editRightsService.ProlongEditRights(tripId, _redisAppSettings.EditRightsProlongedTTL);

                if (result != null)
                {
                    return(Ok(result));
                }
                return(BadRequest(new JsonResult("Location dates are not valid")));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }