// Used recursively to populate all subfolders of a module
        public void PopulateContentDirectory(BbContentDirectory folder)
        {
            string          pageSource   = http.DownloadString(folder.Url.AbsoluteUri);
            List <HtmlNode> contentLinks = HTMLParser.GetContentLinks(pageSource);

            if (contentLinks == null)
            {
                return;
            }
            foreach (HtmlNode link in contentLinks)
            {
                //Console.WriteLine("Adding " + folder.Name + ": " + link.InnerText);
                populateProgress.AppendStatus(".");
                Uri linkURL = new Uri(folder.Url, link.Attributes["href"].Value);
                if (HTMLParser.IsSubFolder(link))   // content is a subfolder
                {
                    BbContentDirectory subFolder = new BbContentDirectory(link.InnerText, linkURL, folder);
                    if (!folder.SubFolders.Contains(subFolder))
                    {
                        folder.AddSubFolder(subFolder);
                    }
                    PopulateContentDirectory(subFolder);
                }
                else if (HTMLParser.IsLearningUnit(link)) //content is a learning unit
                {
                    BbContentDirectory subFolder = new BbContentDirectory(link.InnerText, linkURL, folder);
                    if (!folder.SubFolders.Contains(subFolder))
                    {
                        folder.AddSubFolder(subFolder);
                    }
                    PopulateLearningUnit(subFolder);
                }
                else        // content is a file
                {
                    string        linkType = HTMLParser.GetLinkType(linkURL);
                    BbContentItem newFile  = new BbContentItem(link.InnerText, linkURL, folder, linkType);
                    if (!folder.Files.Contains(newFile))
                    {
                        folder.AddFile(newFile);
                    }
                }
            }
        }
 // Used recursively to populate all subfolders of a module
 public void PopulateContentDirectory(BbContentDirectory folder)
 {
     string pageSource = http.DownloadString(folder.Url.AbsoluteUri);
     List<HtmlNode> contentLinks = HTMLParser.GetContentLinks(pageSource);
     if (contentLinks == null) return;
     foreach (HtmlNode link in contentLinks)
     {
         //Console.WriteLine("Adding " + folder.Name + ": " + link.InnerText);
         populateProgress.AppendStatus(".");
         Uri linkURL = new Uri(folder.Url, link.Attributes["href"].Value);
         if (HTMLParser.IsSubFolder(link))   // content is a subfolder
         {
             BbContentDirectory subFolder = new BbContentDirectory(link.InnerText, linkURL, folder);
             if (!folder.SubFolders.Contains(subFolder))
             {
                 folder.AddSubFolder(subFolder);
             }
             PopulateContentDirectory(subFolder);
         }
         else if (HTMLParser.IsLearningUnit(link)) //content is a learning unit
         {
             BbContentDirectory subFolder = new BbContentDirectory(link.InnerText, linkURL, folder);
             if (!folder.SubFolders.Contains(subFolder))
             {
                 folder.AddSubFolder(subFolder);
             }
             PopulateLearningUnit(subFolder);
         }
         else        // content is a file
         {
             string linkType = HTMLParser.GetLinkType(linkURL);
             BbContentItem newFile = new BbContentItem(link.InnerText, linkURL, folder, linkType);
             if (!folder.Files.Contains(newFile))
             {
                 folder.AddFile(newFile);
             }
         }
     }
 }