change processWhereClause to generateWhereClause

instead of writing onto the context the whereClause is now returned.

Makes it easier to use the function in the upcoming relations changes