private void parseLottery(string tableContent)
        {
              var columns = new List<List<string>>();

              XElement table = XElement.Parse(tableContent);
              XElement headings = table.Elements("tr").First();
              Lottery lottery = new Lottery();
              foreach(XElement th in headings.Elements("th"))
              {
                  string heading = th.Value;
                  var column = new List<string>{heading};
                  columns.Add(column);
                  lottery.Title = heading;
              }

              int row = 0;
              foreach(XElement tr in table.Elements("tr").Skip(1))
              {
                 int i = 0;

                 foreach(XElement td in tr.Elements("td"))
                 {
                    string value = td.Value;
                    if (i != 0) continue;
                    switch (row)
                    {
                        case 0:
                            lottery.Jackpots = value;
                            break;
                        case 1:
                            lottery.First = value;
                            break;
                        case 2:
                            lottery.Second = value;
                            break;
                        case 3:
                            lottery.Third = value;
                            break;
                        case 4:
                            lottery.Fourth = value;
                            break;
                        case 5:
                            lottery.Fifth = value;
                            break;
                        case 6:
                            lottery.Six = value;
                            break;
                        case 7:
                            lottery.Seven = value;
                            break;
                    }

                    columns[i].Add(value);
                    i++;
                 }
                 row++;
             }

              LotteryRepository.Save(lottery);
        }
        private void parseLottery(string tableContent)
        {
                Lottery lottery = new Lottery();
                string html_table = "<table>" + tableContent + "</table>";
                lottery.Html = html_table;
                XElement table = XElement.Parse(html_table);
              XElement headings = table.Elements("tr").First();
             
              foreach(XElement th in headings.Elements("th"))
              {
                  string heading = th.Value;
                  lottery.Title = heading;
              }

              int row = 0;
              foreach(XElement tr in table.Elements("tr").Skip(1))
              {
                 int i = -1;

                 foreach(XElement td in tr.Elements("td"))
                 {
                    i++;
                    string value = td.Value;
                    if (i == 0) continue;
                    switch (row)
                    {
                        case 0:
                            lottery.Jackpots = value;
                            break;
                        case 1:
                            lottery.First = value;
                            break;
                        case 2:
                            lottery.Second = value;
                            break;
                        case 3:
                            lottery.Third = value;
                            break;
                        case 4:
                            lottery.Fourth = value;
                            break;
                        case 5:
                            lottery.Fifth = value;
                            break;
                        case 6:
                            lottery.Six = value;
                            break;
                        case 7:
                            lottery.Seven = value;
                            break;
                    }

                    
                 }
                 row++;
             }
              lottery.JackpotsDate = DateTime.Now;
              lottery.Id = Utils.GenerateRandomId();
              LotteryRepository.Save(lottery);
        }
        private void parseLottery(string tableContent)
        {
              var columns = new List<List<string>>();

              XElement table = XElement.Parse(tableContent);
              XElement headings = table.Elements("tr").First();
              Lottery lottery = new Lottery();
              foreach(XElement th in headings.Elements("th"))
              {
                  string heading = th.Value;
                  var column = new List<string>{heading};
                  columns.Add(column);
                  lottery.Title = heading;
              }  

              foreach(XElement tr in table.Elements("tr").Skip(1))
              {
                 int i = 0;

                 foreach(XElement td in tr.Elements("td"))
                 {
                    string value = td.Value;

                    switch (i)
                    {
                        case 0:
                            lottery.Jackpots = value;
                            break;
                    }

                    columns[i].Add(value);
                    i++;
                 }
              }
        }
        private void parseLottery(string tableContent)
        {
            Lottery lottery = new Lottery();
            lottery.Html = tableContent;
            XElement table = XElement.Parse(tableContent);
            XElement headings = table.Elements("tr").First();

            foreach (XElement th in headings.Elements("th"))
            {
                string heading = th.Value;
                lottery.Title = heading;
            }

            int row = 0;
            foreach (XElement tr in table.Elements("tr").Skip(1))
            {
                int i = -1;

                foreach (XElement td in tr.Elements("td"))
                {
                    i++;
                    string value = td.Value;
                    if (i == 0) continue;
                    switch (row)
                    {
                        case 0:
                            lottery.Jackpots = value;
                            break;
                        case 1:
                            lottery.First = value;
                            break;
                        case 2:
                            lottery.Second = value;
                            break;
                        case 3:
                            lottery.Third = value;
                            break;
                        case 4:
                            lottery.Fourth = value;
                            break;
                        case 5:
                            lottery.Fifth = value;
                            break;
                        case 6:
                            lottery.Six = value;
                            break;
                        case 7:
                            lottery.Seven = value;
                            break;
                    }
                }
                row++;
            }
            lottery.JackpotsDate = DateTime.Now;
            lottery.Id = Utils.GenerateRandomId();

            Lottery checkLottery = LotteryRepository.FindOneBy(l => l.JackpotsDate == DateTime.Now);
            if (checkLottery == null)
                LotteryRepository.Save(lottery);
            else
            {
                lottery.Id = checkLottery.Id;
                lottery.JackpotsDate = checkLottery.JackpotsDate;
                LotteryRepository.Update(lottery);
            }  
        }