private byte[] InternalDownloadFile(PObject document, string actor) { var file = document?.GetSourceFile(); if (file == null) return null; byte[] bytes; if (FileExtensionHelper.IsXpsAlike(file.Name)) { bytes = _fileDownloadService.Download(document.Id, actor); if (bytes != null) return bytes; } var fileLoader = _contextService.GetFileLoader(actor); bytes = fileLoader.Download(file.Id, file.Size); return bytes; }