public async Task <ProgressReport> GetProgress(string FileId) { IDatabase db = _redis.GetDatabase(); var contextIds = db.HashGetAll(RedisKey(FileId)) .Where(entry => entry.Name.Equals("contextId")) .Select(entry => entry.Value); var report = new ProgressReport(); foreach (var contextId in contextIds) { var progressEntries = await db.HashGetAllAsync(RedisKey(contextId)); var progress = progressEntries.ToDictionary(); var fileId = progress["fileId"].IsNullOrEmpty ? "" : progress["fileId"].ToString(); var fileName = progress["fileName"].IsNullOrEmpty ? "" : progress["fileName"].ToString(); int numberOfItems = IntVal(progress["items"]); var items = new bool[numberOfItems]; for (int i = 0; i < numberOfItems; i++) { items[i] = IntVal(progress[i]) > 0; } report.Add(new ProcessingProgress() { FileId = fileId, FileName = fileName, Items = items }); } return(report); }