refactoring out whereStatementForModel