public List<SummaryBlock> GetSummaryBlocks()
        {
            var blocks = new List<SummaryBlock>();

            var decodedString = "";
            var text = "";
            var web = new HtmlWeb();
            const string link = "http://www.theaa.ie/AA/AA-Roadwatch.aspx";

            try
            {
                var doc = web.Load(link);
                //string lastUpdated = doc.DocumentNode.SelectSingleNode("//div[@class='lastUpdated']").InnerText;
                var nodes = doc.DocumentNode.SelectNodes("//div[@class='wideGreyWidget']");
                //var nodes = doc.DocumentNode.SelectNodes("//div[@class='mainTrafficReport']").Descendants();
                //List<String> paraList = new List<String>();
                //SummaryBlock sb = new SummaryBlock();
                foreach (var node in nodes)
                {
                    var sb = new SummaryBlock();
                    //title
                    text = WebUtility.HtmlDecode(node.ChildNodes[1].InnerText);
                    decodedString = Regex.Replace(text,
                        @"\t|\n|\r|<li>|</li>|<ul>|</ul>|<b>|</b>|<em>|</em>|<u>|</u>|<strong>|</strong>|<p>|</p>", "");
                    sb.Title = decodedString;

                    var paraList = new List<String>();
                    //para
                    var d = "";
                    if (node.ChildNodes[3].ChildNodes[1].InnerText != "&nbsp;")
                    {
                        d = WebUtility.HtmlDecode(node.ChildNodes[3].ChildNodes[1].InnerText);
                    }
                    else
                    {
                        d = WebUtility.HtmlDecode(node.ChildNodes[3].InnerText);
                    }

                    if (d != "")
                    {
                        d = d.Replace("\n\n\n", "\n");
                        d = d.Trim();
                        decodedString = Regex.Replace(d,
                            @"\t|\r|<li>|</li>|<ul>|</ul>|<b>|</b>|<em>|</em>|<u>|</u>|<strong>|</strong>|<p>|</p>",
                            "");
                        paraList.Add(decodedString);
                    }
                    else
                    {
                        d = WebUtility.HtmlDecode(node.ChildNodes[3].InnerText);
                        d = d.Replace("\n\n\n", "\n");
                        d = d.Trim();
                        decodedString = Regex.Replace(d,
                            @"\t|\r|<li>|</li>|<ul>|</ul>|<b>|</b>|<em>|</em>|<u>|</u>|<strong>|</strong>|<p>|</p>",
                            "");
                        paraList.Add(decodedString);
                    }

                    sb.Paragraph = paraList;
                    blocks.Add(sb);
                }
            }
            catch (Exception ex)
            {
                var sf = new StackFrame();
                var methodBase = sf.GetMethod();
                Database.InsertRoadwatchErrorToDb(methodBase.Name, ex.Message, ex.ToString());
            }
            return blocks;
        }
        public List<SummaryBlock> GetSummaryBlocks()
        {
            var blocks = new List<SummaryBlock>();
            var web = new HtmlWeb();
            const string link = "http://www.theaa.ie/AA/AA-Roadwatch.aspx";
            var d = "";
            var para = "";
            var updateTime = false;
            try
            {
                var doc = web.Load(link);
                var nodes = doc.DocumentNode.SelectNodes("//div[@class='mainTrafficReport']").Descendants();
                var paraList = new List<String>();
                var sb = new SummaryBlock();
                foreach (var node in nodes.Where(n => n.Name == "#text"))
                {
                    var innerTrimmed = WebUtility.HtmlDecode(node.InnerText).Trim();
                    if (updateTime)
                    {
                        sb = new SummaryBlock();
                        sb.Title = innerTrimmed;
                        paraList.Add("updated");
                        sb.Paragraph = paraList;
                        blocks.Add(sb);
                        paraList = new List<string>();
                        sb = new SummaryBlock();
                        updateTime = false;
                        continue;
                    }
                    if (innerTrimmed == "Last Updated:")
                    {
                        updateTime = true;
                        continue;
                    }
                    if (innerTrimmed == "MAIN TRAFFIC" || innerTrimmed == "*MAIN TRAFFIC*")
                    {
                        if (sb.Title != null)
                        {
                            paraList.Add(para);
                            para = "";
                            sb.Paragraph = paraList;
                            blocks.Add(sb);
                        }
                        paraList = new List<string>();
                        sb = new SummaryBlock();
                        sb.Title = "MAIN TRAFFIC";
                    }
                    else if (innerTrimmed == "CITY TRAFFIC" || innerTrimmed == "*CITY TRAFFIC*")
                    {
                        if (sb.Title != null)
                        {
                            paraList.Add(para);
                            para = "";
                            sb.Paragraph = paraList;
                            blocks.Add(sb);
                        }

                        sb = new SummaryBlock();
                        sb.Title = "CITY TRAFFIC";
                        paraList = new List<string>();
                    }
                    else if (innerTrimmed == "EVENTS" || innerTrimmed == "*EVENTS*")
                    {
                        if (sb.Title != null)
                        {
                            paraList.Add(para);
                            para = "";
                            sb.Paragraph = paraList;
                            blocks.Add(sb);
                        }
                        paraList = new List<string>();
                        sb = new SummaryBlock();
                        sb.Title = "EVENTS";
                    }
                    else if (innerTrimmed == "ROADWORKS" || innerTrimmed == "*ROADWORKS*")
                    {
                        if (sb.Title != null)
                        {
                            paraList.Add(para);
                            para = "";
                            sb.Paragraph = paraList;
                            blocks.Add(sb);
                        }
                        paraList = new List<string>();
                        sb = new SummaryBlock();
                        sb.Title = "ROADWORKS";
                    }
                    else if (innerTrimmed == "TRAVEL" || innerTrimmed == "*TRAVEL*")
                    {
                        if (sb.Title != null)
                        {
                            paraList.Add(para);
                            para = "";
                            sb.Paragraph = paraList;
                            blocks.Add(sb);
                        }
                        paraList = new List<string>();
                        sb = new SummaryBlock();
                        sb.Title = "TRAVEL";
                    }
                    else if (innerTrimmed == "ROAD CONDITIONS" || innerTrimmed == "*ROAD CONDITIONS*")
                    {
                        if (sb.Title != null)
                        {
                            paraList.Add(para);
                            para = "";
                            sb.Paragraph = paraList;
                            blocks.Add(sb);
                        }
                        paraList = new List<string>();
                        sb = new SummaryBlock();
                        sb.Title = "ROAD CONDITIONS";
                    }
                    else
                    {
                        d = WebUtility.HtmlDecode(node.InnerText);
                        d = d.Trim();
                        if (!d.StartsWith("if ("))
                        {
                            if (d != "&nbsp;" && d != "" && d != "\r\n" && d != "Toggle Map" &&
                                d != "National Summary Report" && !d.StartsWith("Last Updated:"))
                            {
                                if (!d.StartsWith("<!"))
                                {
                                    if (IsAllUpper(d) && d.Length > 1)
                                    {
                                        if (para != "")
                                        {
                                            paraList.Add(para);
                                            para = "";
                                        }
                                        if (!d.EndsWith(":"))
                                        {
                                            d = d + ":";
                                        }
                                        paraList.Add(d);
                                    }
                                    else
                                    {
                                        if (d.StartsWith(":") || d.StartsWith(" :"))
                                        {
                                            var index = d.IndexOf(":", StringComparison.Ordinal);
                                            d = (index < 0) ? d : d.Remove(index, 1);
                                            d = d.Trim();
                                        }
                                        if (d.Length > 1)
                                        {
                                            para += d + " ";
                                        }
                                        else
                                        {
                                            para += d;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                }

                paraList.Add(para);
                sb.Paragraph = paraList;
                blocks.Add(sb);
            }
            catch (Exception ex)
            {
                var sf = new StackFrame();
                var methodBase = sf.GetMethod();
                Database.InsertRoadwatchErrorToDb(methodBase.Name, ex.Message, ex.ToString());
            }
            return blocks;
        }