public static void copyWithNewUid(final ByteBuffer sourceByteBuffer,
                                      final ByteBuffer destByteBuffer,
                                      final UID newUid) {
        Objects.requireNonNull(sourceByteBuffer);
        Objects.requireNonNull(destByteBuffer);
        Objects.requireNonNull(newUid);

        if (destByteBuffer.remaining() < sourceByteBuffer.remaining()) {
            throw new RuntimeException(LogUtil.message("Insufficient remaining,\nsource: {},\ndest: {}",
                    ByteBufferUtils.byteBufferInfo(sourceByteBuffer),
                    ByteBufferUtils.byteBufferInfo(destByteBuffer)));
        }

        destByteBuffer.put(newUid.getBackingBuffer());
        final ByteBuffer keyPartBuffer = sourceByteBuffer.slice(
                KEY_OFFSET,
                sourceByteBuffer.remaining() - UID.UID_ARRAY_LENGTH);
        destByteBuffer.put(keyPartBuffer);
        destByteBuffer.flip();
        sourceByteBuffer.rewind();
    }
Copy the contents of sourceByteBuffer into destByteBuffer but with the supplied UID.
stroom-pipeline/src/main/java/stroom/pipeline/refdata/store/offheapstore/serdes/KeyValueStoreKeySerde.java