public RulePack CreateRulePack()
        {
            var totalRules = dataSouce.Count() +
                             dataSouce.Where(n => n.SubCategories.Count > 0).Sum(n => n.SubCategories.count());
            var rulePack = new RulePack
            {
                RulePackID = Guid.NewGuid().ToString(),
                Description = "TeamMentor Secure Coding Rules version 1.0",
                Name = "TeamMentor Secure Coding Rules version 1.0",
                SKU = Guid.NewGuid().ToString(),
                Version = "1.0",
                Rules = new RulePackRules[1]
            };
            //Creating rules
            rule = new RulePackRules
            {
                version = "3.11",
                RuleDefinitions = new RulePackRulesRuleDefinitionsCustomDescriptionRule[totalRules]
            };

            AddRulesWithHtmlContent3(rulePack,totalRules);
            return rulePack;
        }
        private static void AddRulesWithHtmlContent2(RulePack rulePack)
        {
            //Creating rules
            var rule = new RulePackRules
            {
                version = "3.11",
                RuleDefinitions = new RulePackRulesRuleDefinitionsCustomDescriptionRule[dataSouce.count()]
            };

            int index = 0;
            foreach (var item in dataSouce)
            {
                var url = new Uri(item.ArticleUrl);
                var articleUrl = @"<a href=""" + url.hostUrl() + "/article/";
                var matchIndex = 0;
                if (item.SubCategories.notNull())
                    matchIndex = item.SubCategories.count() + 1;
                else matchIndex = 1;
                driver.Url = item.ArticleUrl;
                driver.Navigate();
                System.Threading.Thread.Sleep(3000);
                ReadOnlyCollection<IWebElement> links = driver.FindElements(By.TagName("a"));

               // UpdateRelativeURl(links);

                rule.RuleDefinitions[index] = new RulePackRulesRuleDefinitionsCustomDescriptionRule
                {
                    RuleID = Guid.NewGuid().ToString(),
                    RuleMatch = new RulePackRulesRuleDefinitionsCustomDescriptionRuleRuleMatch[matchIndex],
                    formatVersion = "3.2"
                };
                rule.RuleDefinitions[index].RuleMatch[0] =
                    new RulePackRulesRuleDefinitionsCustomDescriptionRuleRuleMatch();
                rule.RuleDefinitions[index].RuleMatch[0].Category =
                    new RulePackRulesRuleDefinitionsCustomDescriptionRuleRuleMatchCategory[1];
                rule.RuleDefinitions[index].RuleMatch[0].Category[0] =
                    new RulePackRulesRuleDefinitionsCustomDescriptionRuleRuleMatchCategory();
                rule.RuleDefinitions[index].RuleMatch[0].Category[0].Value = item.FortifyCategoryDescription;
                if (item.SubCategories.notNull() && item.SubCategories.count() > 0)
                {
                   rule.RuleDefinitions[index].RuleMatch[0].Subcategory = new RulePackRulesRuleDefinitionsCustomDescriptionRuleRuleMatchSubcategory[item.SubCategories.count()];
                    var newIndex = 0;
                    foreach (var subCat in item.SubCategories)
                    {
                        rule.RuleDefinitions[index].RuleMatch[0].Subcategory [newIndex] = new RulePackRulesRuleDefinitionsCustomDescriptionRuleRuleMatchSubcategory();
                        rule.RuleDefinitions[index].RuleMatch[0].Subcategory[newIndex].Value =
                            subCat.SubCategoryDescription;
                        newIndex ++;
                    }
                }
                 rule.RuleDefinitions[index].Description = new RulePackRulesRuleDefinitionsCustomDescriptionRuleDescription[1];
                rule.RuleDefinitions[index].Description[0] =
                    new RulePackRulesRuleDefinitionsCustomDescriptionRuleDescription();
                //var description = driver.FindElement(By.Id("itemContent")).Text.replace("\r\n", "\r\n\r\n");
                var description = new StringBuilder();
                description.Append(driver.FindElement(By.Id("guidanceItem")).GetAttribute("innerHTML"));

                description = description.Replace("<h1>", "");
                description = description.Replace("</h1>", "\r\n\r\n");
                description = description.Replace("<h2>", "");
                description = description.Replace("</h2>", "\r\n\r\n");
                description = description.Replace("<h3>", "");
                description = description.Replace("</h3>", "\r\n\r\n");
                // description = description.Replace("<a href=\"/article/", articleUrl);

                rule.RuleDefinitions[index].Description[0].Explanation = description.ToString();

                rule.RuleDefinitions[index].Description[0].Recommendations = "Please refer to : " + item.ArticleUrl;

                index++;
            }

            rulePack.Rules[0] = rule;
            driver.Close();
            driver.Quit();
        }