public IList <IRazorNode> ConvertNode(IWebFormsNode node)
        {
            var contentTag           = node as IWebFormsServerControlNode;
            var contentPlaceHolderID = contentTag.Attributes["ContentPlaceHolderID"];
            var convertedChildren    = new List <IRazorNode>();

            foreach (var childNode in node.Children)
            {
                foreach (var converter in NodeConverterProvider.NodeConverters)
                {
                    if (converter.CanConvertNode(childNode))
                    {
                        convertedChildren.AddRange(converter.ConvertNode(childNode));
                    }
                }
            }

            if (string.Compare(contentPlaceHolderID, Configuration.BodyContentPlaceHolderID, true) != 0)
            {
                var sectionNode = SectionNodeFactory.CreateSectionNode(contentPlaceHolderID);
                foreach (var convertedNode in convertedChildren)
                {
                    sectionNode.Children.Add(convertedNode);
                }

                return(new IRazorSectionNode[] { sectionNode });
            }
            else
            {
                return(convertedChildren);
            }
        }
        public IList <IRazorNode> ConvertNode(IWebFormsNode node)
        {
            var contentTag           = node as IWebFormsServerControlNode;
            var shouldRender         = false;
            var contentPlaceHolderID = string.Empty;
            var convertedChildren    = new List <IRazorNode>();

            if (contentTag.Attributes.ContainsKey("ID") && contentTag.TagName.ToLower() == "asp:contentplaceholder")
            {
                shouldRender = true;
            }
            else
            {
                contentPlaceHolderID = contentTag.Attributes["ContentPlaceHolderID"];
            }

            Action <IEnumerable <IRazorNode>, IRazorNode> iterateOverChildrens = (childrens, parentNode) =>
            {
                foreach (var convertedNode in childrens)
                {
                    parentNode.Children.Add(convertedNode);
                }
            };

            foreach (var childNode in node.Children)
            {
                foreach (var converter in NodeConverterProvider.NodeConverters)
                {
                    if (converter.CanConvertNode(childNode))
                    {
                        convertedChildren.AddRange(converter.ConvertNode(childNode));
                    }
                }
            }

            IRazorSectionNode sectionNode = null;

            if (shouldRender)
            {
                sectionNode = SectionNodeFactory.CreateSectionNode(contentTag.Attributes["ID"], true);

                iterateOverChildrens(convertedChildren, sectionNode);
            }
            else if (string.Compare(contentPlaceHolderID, Configuration.BodyContentPlaceHolderID, true) != 0)
            {
                sectionNode = SectionNodeFactory.CreateSectionNode(contentPlaceHolderID);

                iterateOverChildrens(convertedChildren, sectionNode);
            }

            if (sectionNode != null)
            {
                return(new IRazorSectionNode[] { sectionNode });
            }
            else
            {
                return(convertedChildren);
            }
        }