/// <summary>
 /// Finds an existing equal module or returnes null.
 /// </summary>
 /// <param name="prefix"></param>
 /// <param name="namespaceUri"></param>
 /// <param name="namespacePosition"></param>
 /// <returns></returns>
 public SyndicationModule Add(SyndicationModule newModule)
 {
     foreach (SyndicationModule module in this)
     {
         if (module.Prefix == newModule.Prefix)
         {
             string paramName = "namespaceUri";
             if (module.NamespaceURI == newModule.NamespaceURI)
             {
                 if (module.NamespacePosition == newModule.NamespacePosition)
                 {
                     return(module);
                 }
                 else
                 {
                     paramName = "namespacePosition";
                 }
             }
             string msg = string.Format("Illegal to redefine an existing module. Module with prefix already exists.\r\nPrefix: {0}\r\nIllegal parameter: {1}", ((newModule.Prefix == null) ? "" : newModule.Prefix), paramName);
             throw new ArgumentException(msg, "prefix");
         }
     }
     m_items.Add(newModule);
     return(newModule);
 }
 /// <summary>
 /// Deserializes the object from XML.
 /// </summary>
 /// <param name="xnElement"></param>
 /// <param name="exclusionElements"></param>
 private void DeserializeFromXml(XmlNode xnElement, List <SyndicationModuleExclusionElement> exclusionElements)
 {
     foreach (XmlNode node in xnElement.ChildNodes)
     {
         if (node is XmlElement)
         {
             if (!InExclusionList(node, exclusionElements))
             {
                 XmlElement        xeNode = node as XmlElement;
                 SyndicationModule module;
                 if (IsNamespaceInDocumentElement(node.Prefix, node.NamespaceURI, xnElement.OwnerDocument.DocumentElement))
                 {
                     module = new SyndicationModule(node.Prefix, node.NamespaceURI, SyndicationModuleNamespacePosition.DocumentElement);
                 }
                 else
                 {
                     module = new SyndicationModule(node.Prefix, node.NamespaceURI, SyndicationModuleNamespacePosition.Element);
                 }
                 this.Add(module);
                 module.Elements.Add(new SyndicationModuleElement(xeNode));
             }    // if
         }        // if ( node is XmlElement )
     }            // foreach
 }