/// <summary>
            /// Determines which properties of the root parameter were actually referenced in the final projection so that
            /// we can create a $select filter
            /// </summary>
            public ISet<MemberPath> GetReferencedMemberPathsInFinalProjection()
            {
                if (this._pathStack.Count == 0)
                {
                    return null; // select everything
                }

                var visitor = new MemberPathFinder();
                var referencedPaths = this._pathStack.Peek()
                    .Values
                    .SelectMany(visitor.FindPaths)
                    .ToSet(MemberPathComparer);
                return referencedPaths;
            }
            /// <summary>
            /// Determines which properties of the root parameter were actually referenced in the final projection so that
            /// we can create a $select filter
            /// </summary>
            public ISet <MemberPath> GetReferencedMemberPathsInFinalProjection()
            {
                if (this._pathStack.Count == 0)
                {
                    return(null); // select everything
                }

                var visitor         = new MemberPathFinder();
                var referencedPaths = this._pathStack.Peek()
                                      .Values
                                      .SelectMany(visitor.FindPaths)
                                      .ToSet(MemberPathComparer);

                return(referencedPaths);
            }