protected void AddMap <TSource>(string counter, Expression <Func <IEnumerable <CounterEntry>, IEnumerable> > map)
        {
            if (string.IsNullOrWhiteSpace(counter))
            {
                throw new ArgumentException("Counter name cannot be null or whitespace.", nameof(counter));
            }
            if (map == null)
            {
                throw new ArgumentNullException(nameof(map));
            }

            _maps.Add(() =>
            {
                var querySource = (typeof(TSource) == typeof(object))
                    ? "counters"
                    : IndexDefinitionHelper.GetQuerySource(Conventions, typeof(TSource), IndexSourceType.Counters);

                if (StringExtensions.IsIdentifier(counter))
                {
                    querySource = $"{querySource}.{counter}";
                }
                else
                {
                    querySource = $"{querySource}[@\"{counter.Replace("\"", "\"\"")}\"]";
                }

                return(IndexDefinitionHelper.PruneToFailureLinqQueryAsStringToWorkableCode <TSource, TReduceResult>(map, Conventions, querySource, translateIdentityProperty: true));
            });
        }