private Envelope WrapOutputInEnvelope(Type innerType, object output, IDeserializerContext context)
        {
            Envelope envelope = EnvelopeFactory.Create(output, innerType);

            IKeyValueCollection metadata = context.GetEnvelopeMetadata();

            foreach (string key in metadata.Keys)
            {
                envelope.Metadata.Add(key, metadata.Get <object>(key));
            }

            return(envelope);
        }