public static async Task <IDictionary <TKey, bool> > ExistsFilesByKey <TKey>(this IFileSystemOperator @operator, IDistinctValuedDictionary <TKey, string> filePathsByKey) { var keysByFilePath = filePathsByKey.Invert(); var existsByFilePath = await @operator.ExistsFiles(keysByFilePath.Keys.AsDistinct()); var output = keysByFilePath.Join(existsByFilePath, keys => keys.Key, exists => exists.Key, (keys, exists) => (Key: keys.Value, Exists: exists.Value)) .ToDictionary( x => x.Key, x => x.Exists); return(output); }