private LeagueTableModel GenerateLeagueTableModel(PlayerPicks playerPicks)
        {
            var ltm = new LeagueTableModel();

            ltm.Player = playerPicks.Player;
            foreach (var lp in playerPicks.Selections)
            {
                var points = GetPositionDifference(lp);
                if (points == 0)
                {
                    ltm.Correct++;
                }
                ltm.Points += points;
            }


            return(ltm);
        }
        public void PopulatePlayerPicks()
        {
            using (var db = new leaguepredictorEntities())
            {
                var playerSelections = db.players_selections.Select(sel =>
                                                                    new { Player = sel.player.name, Team = sel.team.team_name, Position = sel.position, Id = sel.player.id }).ToList();

                foreach (var p in playerSelections.Select(p => p.Player).Distinct())
                {
                    var pp = new PlayerPicks();
                    pp.Player     = p;
                    pp.ID         = db.players.Where(pl => pl.name.Equals(p)).Single().id;
                    pp.Selections = playerSelections.Where(ps => ps.Player.Equals(pp.Player))
                                    .Select(ps => new LeaguePosition {
                        Team = ps.Team, Position = ps.Position
                    })
                                    .ToList();
                    PlayerPicks.Add(pp);
                }
            }
        }