public override void Serialize( BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options) { if (value == null) { throw new ArgumentNullException("value"); } var objectId = ((BsonObjectId)value).Value; bsonWriter.WriteObjectId(objectId); } }