The ToModel method returns a IEnumberble of SitemapNodeModel, ToModel accepted a T of IEnumberable IPublishedcontent.
List<SitemapNodeModel> list = new List<SitemapNodeModel>();
foreach (var child in children)
{
SitemapNodeModel sitemap = new SitemapNodeModel
{
Id = child.Id,
Name = child.Name,
DocumentTypeAlias = child.DocumentTypeAlias,
Url = child.Url,
UrlName = child.UrlName,
UpdateDate = child.UpdateDate
};
list.Add(sitemap);
}
var children = _umbracoWrapper.Descendants(root)
.Where(x => _umbracoWrapper.GetPropertyValue<bool>(x, "metaSitemap"))
.Select(child => new SitemapNodeModel
{
Id = child.Id,
Name = child.Name,
DocumentTypeAlias = child.DocumentTypeAlias,
Url = child.Url,
UrlName = child.UrlName,
UpdateDate = child.UpdateDate
}).ToList();
var umbracoNodes = new List<SitemapNodeModel>(children);