/// <summary>
        /// Deserializes the specified stream for the specified resource type.
        /// </summary>
        /// <param name="resourceType">Type of the resource.</param>
        /// <param name="stream">The stream.</param>
        /// <returns>The deserialized resource</returns>
        public static IResource Deserialize(string resourceType, Stream stream)
        {
            //UGLY: We have to peek inside the stream to determine the version number

            //House the stream inside a rewindable memory stream
            using (var ms = new MemoryStream())
            {
                Utils.CopyStream(stream, ms);
                ms.Position = 0L; //Rewind

                var rd = ResourceContentVersionChecker.GetVersionFromXmlStream(ms);
                Debug.Assert(rd.ResourceType.Equals(resourceType.ToString()));

                ms.Position = 0L; //Rewind

                using (var reader = new StreamReader(ms))
                {
                    var xml = reader.ReadToEnd();
                    if (_serializers.ContainsKey(rd))
                    {
                        return(_serializers[rd].Deserialize(xml));
                    }
                    else
                    {
                        return(new UntypedResource(xml, resourceType, rd.Version));
                    }
                }
            }
        }
        /// <summary>
        /// Deserializes the specified XML.
        /// </summary>
        /// <param name="xml">The XML.</param>
        /// <returns>The deserialized resource</returns>
        public static IResource Deserialize(string xml)
        {
            var checker = new ResourceContentVersionChecker(xml);
            var rd      = checker.GetVersion();

            if (rd == null)
            {
                throw new SerializationException(Strings.ERR_NOT_RESOURCE_CONTENT_XML);
            }

            if (!_serializers.ContainsKey(rd))
            {
                return(new UntypedResource(xml, rd.ResourceType, rd.Version));
            }

            return(_serializers[rd].Deserialize(xml));
        }