private async Task <XmlDocument> AddNewsArticles(XmlDocument doc, XmlElement rdfElement) { var newsArticles = await newsArticleService.GetAll(); foreach (var newsArticle in newsArticles) { XmlElement element = doc.CreateElement("rdf:Description"); var uri = BaseUrl + "api/newsArticeles/Id" + newsArticle.Id; var twitterUserURI = BaseUrl + "api/twitterUsers/Id/" + newsArticle.UserId; element.SetAttribute("about", uri); var property = doc.CreateElement("Source"); property.InnerText = newsArticle.Source; element.AppendChild(property); property = doc.CreateElement("CredibilityScore"); property.InnerText = string.Empty + newsArticle.CredibilityScore ?? "0"; element.AppendChild(property); property = doc.CreateElement("TwitterUser"); property.InnerText = twitterUserURI; element.AppendChild(property); var newsArticlleVotes = (await voteService.GetAsQueriable()).Where(v => v.NewsArticleId == newsArticle.Id); foreach (var vote in newsArticlleVotes) { var applicationUserURI = BaseUrl + "api/applicationUsers/Id/" + vote.ApplicationUserId; property = doc.CreateElement("VotedBy"); property.InnerText = applicationUserURI; element.AppendChild(property); } rdfElement.AppendChild(element); } return(doc); }