public static <T> ByteBuffer buildDbBuffer(final T object, final Serde<T> serde, final int bufferSize) {
        ByteBuffer byteBuffer = ByteBuffer.allocateDirect(bufferSize);
        serde.serialize(byteBuffer, object);
        return byteBuffer;
    }
Allocates a new direct {@link ByteBuffer} (of size bufferSize) and
serialises the object into that {@link ByteBuffer}

@return The newly allocated {@link ByteBuffer}
stroom-lmdb/src/main/java/stroom/lmdb/LmdbUtils.java