public Stream Download(string id) { try { if (!string.IsNullOrEmpty(id)) { string fileName = string.Empty; var outPutStream = _mainController.Download(id, ref fileName); if (outPutStream != null) { _responseProvider.ResponseContentType(WebOperationContext.Current); _responseProvider.ResponseAddHeaders(WebOperationContext.Current, fileName); _responseProvider.ResponseOk(WebOperationContext.Current); return(outPutStream); } } } catch (Exception e) { _logger.Error(e); _responseProvider.ResponseInternalServerError(WebOperationContext.Current); return(null); } _responseProvider.ResponseInternalServerError(WebOperationContext.Current); return(null); }