/// <summary>
        /// Returns all stats for this season per player
        /// </summary>
        public IEnumerable<Player> GetAllPlayers()
        {
            var reader = new PlayerStatsRetriever(_logger);

            for (int i = 1; i <= PlayerStatsRetriever.MAXPLAYER_ID; i++)
            {
                try
                {
                    if (!_allPlayersCache.ContainsKey(i))
                    {
                        var player = reader.GetPlayerStats(i);
                        _allPlayersCache.Add(i, player);
                    }
                }
                catch (ApplicationException ae)
                {
                    _logger.WriteErrorMessage(string.Format("Error getting player stats for player id {0}: {1}\r\n{2}", i, ae.Message, ae.StackTrace));
                }
                catch (Exception e)
                {
                    // some of the ids may throw - only log to debug logger
                    _logger.WriteDebugMessage(string.Format("Error getting player stats for player id {0}: {1}\r\n{2}", i, e.Message, e.StackTrace));
                }
            }


            return _allPlayersCache.Values;
        }
        /// <summary>
        /// Returns a dictionary mapping 15 player stat objects to sale values, representing the currently selected team of the logged on user
        /// </summary>
        /// <returns>An Dictionary mapping 15 player objects to their sale price</returns>
        public Dictionary<Player, int> GetMySquad()
        {
            var result = new Dictionary<Player, int>();

            CheckAndCreateSession();
            var myTeamReader = GetTransferPageRetriever();
            var playerReader = new PlayerStatsRetriever(_logger);
            var playerIdsToValues = myTeamReader.GetMyTeamTransferValues();

            foreach(var playerId in playerIdsToValues.Keys)
            {
                var player = GetPlayer(playerId, playerReader);
                result[player] = playerIdsToValues[playerId];
            }

            return result;
        }
        /// <summary>
        /// Return a single player's stats
        /// </summary>
        /// <param name="id">The player id (int)</param>
        /// <param name="reader">(optional)</param>
        /// <returns>Player stats</returns>
        public Player GetPlayer(int id, PlayerStatsRetriever reader = null)
        {
            if (reader == null)
                reader = new PlayerStatsRetriever(_logger);

            if (!_allPlayersCache.ContainsKey(id))
            {
                var player = reader.GetPlayerStats(id);
                _allPlayersCache.Add(id, player);
            }

            return _allPlayersCache[id];
        }