public static void Persist(Stream output, IEnumerable <UTinyEntity> entities)
        {
            using (var memory = new MemoryStream())
                using (var writer = new BinaryWriter(memory))
                {
                    writer.Write(BinaryToken.BeginArray);
                    writer.Write((uint)0);
                    foreach (var obj in entities)
                    {
                        BinaryPropertyContainerWriter.Write(memory, obj, s_PropertyVisitor);
                    }
                    writer.Write(BinaryToken.EndArray);

                    const int start = 5;
                    var       end   = memory.Position;
                    var       size  = end - start;
                    memory.Position = start - sizeof(uint);
                    writer.Write((uint)size);
                    output.Write(memory.GetBuffer(), 0, (int)end);
                }
        }
 public static void Persist <TContainer>(Stream output, TContainer container) where TContainer : class, IPropertyContainer
 {
     BinaryPropertyContainerWriter.Write(output, container, s_PropertyVisitor);
 }