protected override ArraySegment <byte> SerializeObject(object value)
 {
     using (var stream = Helper.CreateMemoryStream())
     {
         ProtocolBuffersTranscoder.WriteType(stream, value.GetType());
         Serializer.NonGeneric.Serialize(stream, value);
         return(stream.ToArraySegment());
     }
 }
        protected override object DeserializeObject(ArraySegment <byte> value)
        {
            var raw    = value.Array;
            var count  = value.Count;
            var offset = value.Offset;
            var type   = ProtocolBuffersTranscoder.ReadType(raw, ref offset, ref count);

            using (var stream = Helper.CreateMemoryStream(raw, offset, count))
            {
                return(Serializer.NonGeneric.Deserialize(type, stream));
            }
        }