private string Orgs() { var orgs = db.Orgs .Include(o => o.Parent) .Include(o => o.Children); var sb = new StringBuilder(); using (var csv = new CsvWriter(new StringWriter(sb))) { Org.CsvHeader(csv); foreach (var org in orgs) { org.AsCsvRow(csv); } return(sb.ToString()); } }