IEnumerable <SWIMenuItem> getWebMenu() { var result = new List <SWIMenuItem>(); foreach (var view in WebUser.GetMenuReportViews()) { var menuNames = view.MenuPath.Split('/').Where(i => !string.IsNullOrEmpty(i)).ToList(); if (menuNames.Count > 0) { var menuItem = new SWIMenuItem() { path = view.Report.RelativeFilePath, name = view.MenuReportViewName, viewGUID = view.GUID }; menuNames.RemoveAt(menuNames.Count - 1); if (menuNames.Count > 0) { getMenuFromNames(result, menuNames, menuItem); } else { result.Add(menuItem); } } } return(result.OrderBy(i => i.name)); }