public async Task <IResourceStreamInfo> TryGetResource(string resourceId) { var info = await resourceRepository.Where(v => v.Id == resourceId).Select(v => new { v.Name, v.Path }).FirstOrDefaultAsync(); if (info == null) { return(null); } if (!await resourceProvider.ExistsAsync(info.Path)) { return(null); } var stream = await resourceProvider.ReadAsync(info.Path); if (stream == null) { return(null); } return(new ResourceStreamModel(info.Name, stream)); }