@Override
    public void serialize(UUID uuid, JsonGenerator gen, SerializerProvider serializerProvider) throws IOException {
      final BsonWriter writer = ((BsonGenerator) gen).unwrap();
      codec.encode(writer, uuid, EncoderContext.builder().build());
    }
Custom deserializer for UUID (stored as {@link BsonType#BINARY})
mongo/test/org/immutables/mongo/fixture/JacksonRepoTest.java