public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index)
 {
     if (resultOperator is CountResultOperator || resultOperator is LongCountResultOperator)
     {
         // For count operators, we can remove any order-by result operators
         var bodyClauses = queryModel.BodyClauses.OfType <OrderByClause>().ToList();
         foreach (var orderby in bodyClauses)
         {
             queryModel.BodyClauses.Remove(orderby);
         }
     }
     if (resultOperator is CastResultOperator)
     {
         Array.ForEach(queryModel.ResultOperators.OfType <CastResultOperator>().ToArray(), castOperator => queryModel.ResultOperators.Remove(castOperator));
     }
     if (resultOperator is AnyResultOperator)
     {
         ResultOperatorRemover.Remove(queryModel, x => x is FetchRequestBase);
     }
     base.VisitResultOperator(resultOperator, queryModel, index);
 }
        public static void Remove(QueryModel queryModel, Func <ResultOperatorBase, bool> predicate)
        {
            var rewriter = new ResultOperatorRemover(predicate);

            rewriter.VisitQueryModel(queryModel);
        }