/// <returns>New ETag</returns>
        private string WriteToStream(MetadataPrefixStream stream, object item, Type type, IDataSerializer serializer = null)
        {
            byte[] result;
            using (var resultStream = new MemoryStream())
            {
                (serializer ?? _defaultSerializer).Serialize(item, resultStream, type);
                result = resultStream.ToArray();
            }

            stream.Seek(0, SeekOrigin.Begin);
            stream.Write(result, 0, result.Length);
            stream.SetLength(result.Length);
            return(stream.WriteNewETag());
        }
        private string WriteToStream(MetadataPrefixStream stream, Stream item)
        {
            byte[] result;
            using (var resultStream = new MemoryStream())
            {
                item.Position = 0;
                item.CopyTo(resultStream);
                result = resultStream.ToArray();
            }

            stream.Seek(0, SeekOrigin.Begin);
            stream.Write(result, 0, result.Length);
            stream.SetLength(result.Length);
            stream.Seek(0, SeekOrigin.Begin);
            return(stream.WriteNewETag());
        }