public IEnumerable <KeyValuePair <string, bool> > Get() { var etcdResponse = _etcdClient.Get(_applicationDirectoryKey); if (etcdResponse == null || etcdResponse.Node.Nodes == null) { return(Enumerable.Empty <KeyValuePair <string, bool> >()); } return(etcdResponse.Node.Nodes .Select(node => { if (node.Dir) { return node.Nodes .Where(x => !x.Key.EndsWith("/@meta")) .Select(x => new KeyValuePair <string, bool?>(ExtractFeatureToggleName(x.Key), ParseFeatureToggleValue(x.Key, x.Value))) .ToArray(); } return new[] { new KeyValuePair <string, bool?>(ExtractFeatureToggleName(node.Key), ParseFeatureToggleValue(node.Key, node.Value)) }; }) .SelectMany(x => x) .Where(pair => pair.Value.HasValue) .Select(pair => new KeyValuePair <string, bool>(pair.Key, pair.Value.Value))); }