def update_apartment(self, apartment_dto, send_event=True):
        # type: (ApartmentDTO, bool) -> ApartmentDTO
        self._check_rebus_ids(apartment_dto)
        if 'id' not in apartment_dto.loaded_fields or apartment_dto.id is None:
            raise RuntimeError('cannot update an apartment without the id being set')
        try:
            apartment_orm = Apartment.get_by_id(apartment_dto.id)
            loaded_apartment_dto = ApartmentMapper.orm_to_dto(apartment_orm)
            for field in apartment_dto.loaded_fields:
                if field == 'id':
                    continue
                if hasattr(apartment_dto, field):
                    setattr(loaded_apartment_dto, field, getattr(apartment_dto, field))
            apartment_orm = ApartmentMapper.dto_to_orm(loaded_apartment_dto)
            apartment_orm.save()
            if send_event:
                ApartmentController.send_config_change_event('update')
            return ApartmentMapper.orm_to_dto(apartment_orm)
        except Exception as e:
            raise RuntimeError('Could not update the user: {}'.format(e))