public void WriteCsv()
        {
            var season = _seasonReader.ReadSeason();
            var table  = new SimpleTableOfColumns();

            foreach (var lineup in season)
            {
                var column = table.NewColumn();
                column.Add($"{lineup.Date.ToString("M")} - {lineup.Index}");
                foreach (var name in lineup.BattingOrder)
                {
                    column.Add(name);
                }
            }

            using (var textWriter = File.CreateText(Program.CsvFile))
            {
                var csv = new CsvWriter(textWriter);

                foreach (var row in table.Rows)
                {
                    foreach (var cell in row)
                    {
                        csv.WriteField(cell);
                    }
                    csv.NextRecord();
                }
            }
        }
        public Player[] GetTeam()
        {
            var roster = _rosterReader.ReadPlayers();
            var season = _seasonReader.ReadSeason();

            var players = roster.Select(name => new Player {
                Name = name
            }).ToArray();

            foreach (var lineup in season)
            {
                if (lineup.HasBattingOrder)
                {
                    var first = players.SingleOrDefault(x => x.Name.Equals(lineup.BattingOrder.First()));
                    var last  = players.SingleOrDefault(x => x.Name.Equals(lineup.BattingOrder.Last()));
                    if (first != null)
                    {
                        first.FirstCount++;
                    }
                    if (last != null)
                    {
                        last.LastCount++;
                    }
                }
            }

            return(players);
        }
        public void Populate()
        {
            var season = _reader.ReadSeason();

            foreach (var lineup in season)
            {
                if (!lineup.HasBattingOrder)
                {
                    _lineupPopulater.Populate(lineup);
                    _writer.SaveSeason(season);
                }
            }
        }