public byte[] CreateCsv(object data) { var outputStream = new System.IO.MemoryStream(); using (var writer = new CsvStreamWriter(outputStream)) { writer.WriteModel(data); } return(outputStream.ToArray()); }