class DataFetchingUtils {

    public Optional<Delivery> getCommercialDelivery(final RepositoryHandler repoHandler,
                                                    final String name,
                                                    final String version) {

        final Optional<DbProduct> productOptional = repoHandler.getOneByQuery(DbCollections.DB_PRODUCT,
                makeQuery(name, version),
                DbProduct.class);

        if(!productOptional.isPresent()) {
            return Optional.empty();
        }

        final DbProduct dbProduct = productOptional.get();

        final List<Delivery> filtered = dbProduct.getDeliveries()
                .stream()
                .filter(d -> d.getCommercialName().equals(name) &&
                        d.getCommercialVersion().equals(version)

                )
                .collect(Collectors.toList());

        if(filtered.isEmpty()) {
            return Optional.empty();
        }

        if (filtered.size() > 1 && LOG.isWarnEnabled()) {
            LOG.warn(String.format("Multiple commercial version entries found for [%s] [%s]", name, version));
        }

        return Optional.of(filtered.get(0));
    }

}