private async Task CheckForWin() { var spaghettiPlayerId = data.Sides.Single(pair => pair.Value == CharacterSide.Spaghetti).Key; var anySpaghetti = data.Characters.Any(character => character.OwnerPlayerId == spaghettiPlayerId); var unicornPlayerId = data.Sides.Single(pair => pair.Value == CharacterSide.Unicorn).Key; var anyUnicorn = data.Characters.Any(character => character.OwnerPlayerId == unicornPlayerId); if (!anySpaghetti || !anyUnicorn) { if (!anySpaghetti && anyUnicorn) { data.SetWinnerSide(CharacterSide.Unicorn); } else if (anySpaghetti && !anyUnicorn) { data.SetWinnerSide(CharacterSide.Spaghetti); } await battleManager.SaveBattle(data); GameOver?.Invoke(data); } }