serialize static method
Implementation
static BsonBinary serialize(BsonSerializable object) {
var bsonObject = BsonObject.from(
object, SerializationParameters(serializeObjects: true));
var buffer = BsonBinary(bsonObject.totalByteLength);
bsonObject.packValue(buffer);
return buffer;
}