public virtual void Parse(XNode element) { List <string> attributesKey = this.Attributes.Select(x => x.Key).ToList(); foreach (string attribute in attributesKey) { this.Attributes[attribute] = ((XElement)element).Attribute(attribute)?.Value; } foreach (XNode subElement in ((XElement)element).Nodes()) { ASubTag tag = TagFactory.CreateASubTag(subElement is XElement ? ((XElement)subElement).Name.LocalName : string.Empty); tag.Parse(subElement); this.Tags.Add(tag); } }