private void CreateLayout(DefineLayoutTabsAttribute[] tabs, List <ItemLayoutInfo> items, DefineLayoutGroupAttribute[] groups, string parent, IModelNode parentGroup) { var curr = groups.Where(x => x.Parent == parent).OrderBy(x => x.Index); foreach (var item in curr) { IModelLayoutGroup newNode = parentGroup.AddGroup(item.GroupID, item.Direction, item.ShowCaption, item.Caption, item.ImageName, item.Index); var lis = items.Where(x => x.Group == item.GroupID).OrderBy(x => x.Index).ToArray(); foreach (var li in lis) { newNode.AddItem(li.Item, li.Index); } CreateLayout(tabs, items, groups, item.GroupID, newNode); } var currTabs = tabs.Where(x => x.Parent == parent); foreach (var item in currTabs) { var child = parentGroup.AddTab(item.TabID, item.Index); CreateLayout(tabs, items, groups, item.TabID, child); } }