private static byte[] serialize(Geometry geometry) {
        if (geometry == null) {
            return null;
        }
        WKBWriter writer = new WKBWriter(2, wkbNDR, true);
        return writer.write(geometry);
    }
Serializes a geometry in the WKB format.

@param geometry An {@link Geometry} object or one of its subclasses. May be null.
@return A byte array representing the Geometry object in WKB format or null if the object was null.
postgis/src/main/java/org/jdbi/v3/postgis/PostgisCodec.java