protected override void WriteToJson(Newtonsoft.Json.JsonWriter writer)
 {
     base.WriteToJson(writer);
     writer.WritePropertyName("size");
     writer.WriteValue(Size);
     writer.WriteEnd();
 }
 private void WriteExtendedJson(Newtonsoft.Json.JsonWriter writer, BsonBinaryData binaryData, Newtonsoft.Json.JsonSerializer serializer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("$binary");
     writer.WriteValue(Convert.ToBase64String(binaryData.Bytes));
     writer.WritePropertyName("$type");
     writer.WriteValue(((int)binaryData.SubType).ToString("x2"));
     writer.WriteEnd();
 }