class LocationRepositoryImpl implements LocationRepository {

    @Override
    public Location removeLocation(long id) {
        Optional<LocationEntity> maybeLocation = repository.findById(id);
        maybeLocation.ifPresent(locationEntity -> repository.deleteById(id));
        LocationEntity locationEntity = maybeLocation.orElseThrow(
                () -> new IllegalArgumentException("Location{id=" + id + "} doesn't exist"));
        Location location = toDomain(locationEntity);
        logger.info("Deleted location {}.", location.fullDescription());
        return location;
    }

    @Autowired  LocationRepositoryImpl(LocationCrudRepository repository);

}