public async Task AddSerializedAsset(IElement element, string uriAttribute)
        {
            var src = element.Attributes[uriAttribute].Value;

            // remove any querystring from images
            if (element.TagName.ToLower() == "img")
            {
                var qI = src.LastIndexOf('?');
                if (qI > 0)
                {
                    src = src.Substring(0, qI);
                }
                var hI = src.LastIndexOf('#');
                if (hI > 0)
                {
                    src = src.Substring(0, hI);
                }
            }
            var localPath = await Zipper.ReturnLocalPath(src);

            if (localPath != string.Empty)
            {
                var suffix = src.Split('.').Last().ToLower();
                if (suffix == localPath)
                {
                    switch (element.TagName.ToLower())
                    {
                    case "link":
                        suffix = "css";
                        break;

                    case "script":
                        suffix = "js";
                        break;

                    default:
                        break;
                    }
                    ;
                }
                var newSrc = Guid.NewGuid().ToString().Replace("-", "") + "." + suffix;
                if (!this.Assets.Any(a => a.OriginalPath == localPath))
                {
                    this.Assets.Add(new AssetPath
                    {
                        OriginalPath   = localPath,
                        SerializedName = newSrc,
                        AssetType      = suffix
                    });
                }
            }
        }
        private async Task <AssetPathCollection> ExtractAssets(string source, string suffix, string pagePath, AssetPathCollection assets)
        {
            if (suffix.ToLower().StartsWith("htm"))
            {
                var parser = new AngleSharp.Parser.Html.HtmlParser();
                var doc    = parser.Parse(source);
                var images = doc.Images
                             .Where(x => x.HasAttribute("src"));
                var styles = doc.GetElementsByTagName("link")
                             .Where(l => l.Attributes["rel"].Value.Trim().ToLower() == "stylesheet")
                             .Where(c => c.HasAttribute("href"));
                var scripts = doc.GetElementsByTagName("script")
                              .Where(x => x.HasAttribute("src"));
                assets.AddSerializedAssets(images, "src");
                assets.AddSerializedAssets(scripts, "src");
                assets.AddSerializedAssets(styles, "href");
                foreach (var asset in assets.Assets.Where(a => a.AssetType == "css"))
                {
                    var content = await Zipper.GetStringAsset(asset.OriginalPath, mapPathResolver, webRoot, pagePath);

                    var binaryContent = Encoding.UTF8.GetBytes(content);
                    asset.Content = binaryContent;
                    await ExtractAssets(content, "css", asset.OriginalPath, assets);
                }

                foreach (var asset in assets.Assets.Where(a => a.AssetType != "css"))
                {
                    var binaryContent = await Zipper.GetBinaryAsset(asset.OriginalPath, mapPathResolver, webRoot, pagePath);

                    asset.Content = binaryContent;
                }
            }
            else if (suffix.ToLower() == "css")
            {
                var urls = Zipper.ExtaxtUrlsFromStyle(source);
                foreach (var url in urls)
                {
                    var csslocalPath = await Zipper.ReturnLocalPath(url);

                    var csssuffix = csslocalPath.Split('.').Last();
                    var newUrl    = Guid.NewGuid().ToString().Replace("-", "") + "." + suffix;
                    source = source.Replace(url, newUrl);
                    //assets.AddSerializedAssets()
                    //if (!doneAssets.Contains(newUrl))
                    //{
                    //    zipArchive.AddBinaryAssetToArchive(newUrl, localPath, mapPathResolver, webRoot, serialStyle.Key);
                    //    doneAssets.Add(newUrl);
                    //}
                }
            }
            return(assets);
        }