public async Task <HttpResponseMessage> CreateReport([FromUri] ReportParameters parameters) { try { var filePath = await _reportLogic.Value.CreateReport(((WindowsIdentity)RequestContext.Principal.Identity).AccessToken, parameters); var fileId = FileStorageHelper.CopyFileToStorage(filePath, GetOutputReportFilename(filePath, parameters.Scenario, parameters.Year, parameters.KindVgo)); return(Request.CreateResponse(HttpStatusCode.OK, fileId)); } catch (InvalidParameterException ex) { return(HandleExceptionMessage(HttpStatusCode.BadRequest, "Invalid parameter value", ex)); } catch (Exception ex) { return(HandleExceptionMessage(HttpStatusCode.InternalServerError, "Failed to create report", ex)); } }