public List <List <string> > ArrangeItems() { var dic = new Dictionary <List <string>, long>(); var goldAmount = GetGoldAmount(); var goldPrefix = new List <string>(); goldPrefix.Add("<Gold> $" + goldAmount); Gold = Gold.OrderByDescending(g => g.Name).ThenBy(g => g.Value).ToList(); var gold = goldPrefix.Concat(Gold.Select(g => $"##{g.Name} - {g.Value}").ToList()).ToList(); if (gold.Count > 1) { dic.Add(gold, goldAmount); } var gemsAmount = GetGemsAmount(); var gemsPrefix = new List <string>(); gemsPrefix.Add("<Gem> $" + gemsAmount); Gems = Gems.OrderByDescending(g => g.Name).ThenBy(g => g.Value).ToList(); var gems = gemsPrefix.Concat(Gems.Select(g => $"##{g.Name} - {g.Value}").ToList()).ToList(); if (gems.Count > 1) { dic.Add(gems, gemsAmount); } var cashAmount = GetCashAmount(); var cashPrefix = new List <string>(); cashPrefix.Add("<Cash> $" + cashAmount); Cash = Cash.OrderByDescending(c => c.Name).ThenBy(c => c.Value).ToList(); var cash = cashPrefix.Concat(Cash.Select(g => $"##{g.Name} - {g.Value}").ToList()).ToList(); if (cash.Count > 1) { dic.Add(cash, cashAmount); } return(dic .OrderByDescending(v => v.Value) .Select(e => e.Key) .ToList()); }