private static NavigationGroupDto GetNavigationGroupDto(XElement xGroup, int counter)
        {
            var @group = new NavigationGroupDto()
            {
                Description = xGroup.EmptyIfNull("description"),
                Display = xGroup.EmptyIfNull("display"),
                Key = xGroup.EmptyIfNull("key"),
                Weight = counter * 100
            };

            if (!xGroup.Elements("icon").Any()) return @group;
            var icon = xGroup.Elements("icon").First();
            if (icon.Elements("cssclass").Any())
            {
                @group.IconCssClass = icon.Elements("cssclass").Single().Value;
            }
            return @group;
        }
 private static NavigationElementDto GetNavigationElementDto(XElement xElement, int id, int parentId, NavigationGroupDto @group)
 {
     var element = new NavigationElementDto()
     {
         Display = xElement.EmptyIfNull("display"),
         Id = id,
         Href = xElement.EmptyIfNull("href"),
         Group = @group,
         ParentId = parentId,
         Weight = id * 10,
     };
     if (xElement.Descendants("icon").Any())
     {
         var icon = xElement.Elements("icon").First();
         if (icon.Elements("cssclass").Any())
         {
             element.IconCssClass = icon.Elements("cssclass").Single().Value;
         }
     }
     var role = NavigationElementRole.Anchor;
     Enum.TryParse(xElement.EmptyIfNull("role"), true, out role);
     element.Role = role;
     return element;
 }
        protected virtual void Traverse(XContainer xElement, NavigationGroupDto @group, ref int seq)
        {
            if (xElement.Element("elements") == null || !xElement.Element("elements").Elements("element").Any()) return;
            var parentId = seq;

            foreach (var descendant in xElement.Element("elements").Elements("element"))
            {
                seq++;
                var element = GetNavigationElementDto(descendant, seq, parentId, @group);

                //if (descendant.Descendants("icon").Any())
                //{
                //    var icon = descendant.Elements("icon").First();
                //    if (icon.Elements("cssclass").Any())
                //    {
                //        element.IconCssClass = icon.Elements("cssclass").Single().Value;
                //    }
                //}
                _data.Add(element);
                Traverse(descendant, @group, ref seq);
            }
        }