public async void PrepareFileForDownload(string datasetId) // prepare the file in server { _exportService.SetDatasetStatus(datasetId, "", 1); UserDataset dataset; var filePath = _exportService.GetDownloadPath(datasetId, out dataset); try { var fileInfo = await _exportService.CreateFileForDataset(dataset, filePath); _exportService.SetDatasetStatus(datasetId, fileInfo.FullName, 2); } catch (Exception e) { // in the case of an error the file status should be changed to 0 _exportService.SetDatasetStatus(datasetId, "", 3); throw e; } }