public HttpResponseMessage ExportMatrix() { var currMatrix = _matrixservce.GetCurrentMatrix(); var matrixToStream = _convertservce.MatrixToStream(currMatrix); var result = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StreamContent(matrixToStream) }; result.Content.Headers.ContentType = new MediaTypeHeaderValue("text/csv"); result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = "MatrixExport.csv" }; return(result); }