public void UpdateWithEndRaceResult(List <PlayerRank> rankings) { List <PlayerRank> orderedCompetitorRanks = new List <PlayerRank>(); foreach (PlayerRank rank in rankings.OrderBy(r => r.Rank)) { foreach (Competitor competitor in Competitors) { if (rank.Login == competitor.Login) { orderedCompetitorRanks.Add(rank); break; } } } int[] points = new [] { 10, 7, 5, 2, 1 }; for (int i = 0; i < orderedCompetitorRanks.Count; i++) { if (i >= points.Length) { break; } PlayerRank competitorRank = orderedCompetitorRanks[i]; if (competitorRank.BestTime <= 0) { break; } Competitor competitor = Competitors.Find(c => c.Login == competitorRank.Login); if (competitor == null) { continue; } competitor.Score += points[i]; } DrivenRounds++; }