public async Task <GenericObjectResponse <RoomResponse> > AddRoom(CreateRoomPayload payload, long?userId)
        {
            try
            {
                Logger.Debug($"Attempting to create new room for user {userId}");
                RoomResponse          roomResponse     = null;
                RoomValidationService service          = new RoomValidationService();
                GenericStatusMessage  validationResult = service.ValidateRoomData(payload);
                if (!validationResult.Success)
                {
                    return(new GenericObjectResponse <RoomResponse>(validationResult.Message));
                }

                using (ReservationDataContext context = new ReservationDataContext())
                {
                    Room room = ConvertRoomFromPayload(payload, userId);
                    context.Rooms.Add(room);
                    context.SaveChanges();
                    roomResponse = ConvertRoomToResponse(room, userId);
                }

                Logger.Debug($"Attempting to create working hours for room {roomResponse.Id}");
                WorkingHoursManipulationService workingHoursService = new WorkingHoursManipulationService();
                GenericObjectResponse <List <WorkingHoursPayload> > workingHours = workingHoursService.ChangeWorkingHoursForRoom(roomResponse.Id, payload.WorkingHours);
                if (!workingHours.Status.Success)
                {
                    Logger.Error($"failed to create working hours for room {roomResponse.Id}, Deleting created room.");
                    using (ReservationDataContext context = new ReservationDataContext())
                    {
                        Room room = context.Rooms.Single(x => x.Id == roomResponse.Id);
                        context.Rooms.Remove(room);
                        context.SaveChanges();
                    }
                    return(new GenericObjectResponse <RoomResponse>($"Failed to add room due to faulty working hours: {workingHours.Status.Message}"));
                }
                roomResponse.WorkingHours = workingHours.Object;
                Logger.Debug($"Room created for user {userId}.");
                LatLon latLon = await AddLatLonForRoom(roomResponse.Id);

                if (latLon != null)
                {
                    roomResponse.Lat = latLon.Lat;
                    roomResponse.Lon = latLon.Lon;
                }
                return(new GenericObjectResponse <RoomResponse>(roomResponse));
            }
            catch (DbEntityValidationException e)
            {
                string exceptionMessage = e.EntityValidationErrors.FirstOrDefault()?.ValidationErrors.FirstOrDefault()?.ErrorMessage;
                Logger.Error($"Failed to create room. Error: '{exceptionMessage}'");
                return(new GenericObjectResponse <RoomResponse>("Failed to add the room, please contact support."));
            }
        }
        public async Task <GenericObjectResponse <RoomResponse> > ChangeRoomData(CreateRoomPayload payload, long roomId)
        {
            RoomValidationService service            = new RoomValidationService();
            GenericStatusMessage  validationResponse = service.ValidateRoomData(payload, false);
            RoomResponse          roomResponse       = null;

            if (validationResponse.Success)
            {
                using (ReservationDataContext context = new ReservationDataContext())
                {
                    Room room = context.Rooms.Include(x => x.WorkingHours).Single(x => x.Id == roomId);
                    room.Name = payload.Name ?? room.Name;
                    room.Size = payload.Size ?? room.Size;
                    room.MaxNumberOfPeople = payload.MaxNumberOfPeople ?? room.MaxNumberOfPeople;
                    room.Country           = payload.Country ?? room.Country;
                    room.City           = payload.City ?? room.City;
                    room.Street         = payload.Street ?? room.Street;
                    room.BuildingNumber = payload.BuildingNumber ?? room.BuildingNumber;
                    context.SaveChanges();
                    roomResponse = ConvertRoomToResponse(room, room.OwnerId);
                }

                LatLon latLon = await AddLatLonForRoom(roomResponse.Id);

                if (latLon != null)
                {
                    roomResponse.Lat = latLon.Lat;
                    roomResponse.Lon = latLon.Lon;
                }

                return(new GenericObjectResponse <RoomResponse>(roomResponse));
            }
            else
            {
                return(new GenericObjectResponse <RoomResponse>(validationResponse.Message));
            }
        }