public static Expression <Func <T, bool> > MakePropertiesPredicate <T, TValue>(Expression <Func <TValue, TValue, bool> > pattern, TValue searchValue, bool isOr)
        {
            var parameter  = Expression.Parameter(typeof(T), "e");
            var searchExpr = Expression.Constant(searchValue);

            var predicateBody = typeof(T).GetProperties()
                                .Where(p => p.PropertyType == typeof(TValue))
                                .Select(p =>
                                        ExpressionReplacer.GetBody(pattern, Expression.MakeMemberAccess(
                                                                       parameter, p), searchExpr))
                                .Aggregate(isOr ? Expression.OrElse : Expression.AndAlso);

            return(Expression.Lambda <Func <T, bool> >(predicateBody, parameter));
        }