public void SaveHighscoresTable() { var localScores = ScoresManager.Instance.Scores; var globalScores = _scoresTable.FindAll(); var scoresTable = new ScoreTable(); foreach (var score in globalScores) { scoresTable.AddNew(score.Element); } for (int i = 0; i < localScores.Count; i++) { scoresTable.AddNew(localScores[i]); } for (int i = 0; i < scoresTable.Scores.Count; i++) { if (i >= globalScores.Count) { _scoresTable.Add(scoresTable.Scores[i]); continue; } if (globalScores[i].Element.Score < scoresTable.Scores[i].Score) { globalScores[i].Element = scoresTable.Scores[i]; globalScores[i].Update(); } } }