public async Task <byte[]> LoadDocumentFromSystemAsync(string client, string documentName) { var path = Path.Combine(_root, client, documentName); using (var source = File.OpenRead(path)) { using (var destination = new MemoryStream()) { await source.CopyToAsync(destination); var extension = Path.GetExtension(documentName)?.Replace(".", ""); var loader = LoaderFactory.Select(extension); return(await loader.LoadFileAsync(destination)); } } }