public static <R extends UpdatableRecord<R>> R create(final DataSource dataSource, final R record) {
        LOGGER.debug(() -> "Creating a " + record.getTable() + " record:\n" + record);
        try (final Connection connection = dataSource.getConnection()) {
            try {
                checkDataSource(dataSource);
                final DSLContext context = createContext(connection);
                record.attach(context.configuration());
                record.store();
            } finally {
                releaseDataSource();
            }
        } catch (final Exception e) {
            throw convertException(e);
        }
        return record;
    }
@param dataSource
@param function
@param <R>
@return
@throws stroom.util.exception.DataChangedException If another thread/node has already changed the data
stroom-db-util/src/main/java/stroom/db/util/JooqUtil.java