private List <MenuOrdenesItem> FillMenuDictionary(List <MenuOrdenesItem> menuPrincipal) { var user = MAEUserSession.Instancia; if (user.MenuDic == null) { user.MenuDic = new Dictionary <string, string>(); } var encryptor = new AESEncryptor(); foreach (MenuOrdenesItem menu in menuPrincipal) { if (menu.items.Any()) { foreach (MenuOrdenesItem item in menu.items) { var key = encryptor.DynamicEncryption(item.url); if (!user.MenuDic.ContainsValue(item.url)) { user.MenuDic.Add(key, item.url); item.url = key; } else { item.url = user.MenuDic.FirstOrDefault(x => x.Value == item.url).Key; } } } else { var key = encryptor.DynamicEncryption(menu.url); if (!user.MenuDic.ContainsValue(menu.url)) { user.MenuDic.Add(key, menu.url); menu.url = key; } else { menu.url = user.MenuDic.FirstOrDefault(x => x.Value == menu.url).Key; } } } return(menuPrincipal); }