refactor where clauses into lambdas in the models