public static void ReadObjectProperties(XmlReader reader, object obj, PropertyConversionHandler handler = null)
        {
            // Build property lookup table
            PropertyInfo[] props = obj.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public);
            Dictionary<string, PropertyInfo> propHash = new Dictionary<string, PropertyInfo>(props.Length);
            foreach (var pi in props)
                if (!Attribute.IsDefined(pi, typeof(XmlIgnoreAttribute), false))
                    propHash.Add(GetPropertyElementName(pi), pi);

            while (reader.MoveToContent() == System.Xml.XmlNodeType.Element)
            {
                PropertyInfo pi;
                if (propHash.TryGetValue(reader.LocalName, out pi))
                {
                    if (IsStandardType(pi.PropertyType))
                    {
                        object value = null;
                        if (pi.PropertyType.IsEnum)
                            value = Enum.Parse(pi.PropertyType, reader.ReadElementContentAsString());
                        else
                            value = reader.ReadElementContentAs(pi.PropertyType, null);

                        if (handler != null)
                            handler(pi, obj, ref value);

                        pi.SetValue(obj, value, null);
                    }
                    else
                    {
                        ReadObject(reader, pi.GetValue(obj, null));
                    }
                }
                else
                {
                    reader.Skip();
                    reader.MoveToContent();
                }
            }
        }
        public static void ReadObject(XmlReader reader, object obj, PropertyConversionHandler handler = null)
        {
            if (obj == null)
                throw new ArgumentNullException("obj");

            reader.MoveToContent();

            if (obj is IXmlSerializable)
            {
                ((IXmlSerializable)obj).ReadXml(reader);
            }
            else
            {
                object oVal = null;
                string oName = GetAttributeValue(obj.GetType(), typeof(XmlRootAttribute), "ElementName", true, ref oVal) ? oVal.ToString() : obj.GetType().Name;
                if (reader.LocalName != oName)
                    throw new XmlException("XML element name does not match object.");

                if (!reader.IsEmptyElement)
                {
                    reader.ReadStartElement();
                    reader.MoveToContent();
                    ReadObjectProperties(reader, obj, handler);
                    reader.ReadEndElement();
                }
                else
                    reader.Skip();
            }
        }
	// DEBUG INFORMATION

	// Method updates warning log and moves XML reader passed unknown elements
	void displayWarning(XmlReader myReader,string elementName,string parentTag)
	{
		// Set warning flag and add details to error log
		warning = true;
		myLog += "\nFound in Jellyfish '" + jellyfishName + "':" +
		"\nUnknown element found inside <"+parentTag+"> tag: <"+elementName+">\n";

		// Reader skips this unrecognised element (and all child elements of this tag)
		myReader.Skip();
	}