class SimpleCatalogManager implements CatalogManager {

    @Override
    public <T extends Version> void addVersion(Resource catalogId, Resource versionedRecordId, T version) {
        try (RepositoryConnection conn = configProvider.getRepository().getConnection()) {
            VersionedRecord record = utils.getRecord(catalogId, versionedRecordId, versionedRecordFactory, conn);
            if (conn.containsContext(version.getResource())) {
                throw utils.throwAlreadyExists(version.getResource(), versionFactory);
            }
            record.setLatestVersion(version);
            Set<Version> versions = record.getVersion_resource().stream()
                    .map(versionFactory::createNew)
                    .collect(Collectors.toSet());
            versions.add(version);
            record.setVersion(versions);
            conn.begin();
            utils.updateObject(record, conn);
            utils.addObject(version, conn);
            conn.commit();
        }
    }

    public  SimpleCatalogManager();

}