public HttpResponseMessage DownlodFromBlob(int companyid, int documentid) { HttpResponseMessage serviceProvider = requestHandler.GetObject(Request, companyid); if (serviceProvider == null) { return(Request.CreateResponse(HttpStatusCode.BadRequest, new ErrorObject { ErrorMessage = "Blob storage provider not found for this company", errorObject = "", ErrorLevel = ErrorLevel.Error })); } HttpResponseMessage documentPath = requestHandler.GetByDocumentId(Request, documentid); if (documentPath == null) { return(Request.CreateResponse(HttpStatusCode.BadRequest, new ErrorObject { ErrorMessage = "No document found", errorObject = "", ErrorLevel = ErrorLevel.Error })); } return(blobhandler.DownloadFromBlob(Request, companyid, ((ObjectContent)documentPath.Content).Value.ToString(), ((ObjectContent)serviceProvider.Content).Value.ToString())); }