start switching over to QueryBuilder

Use QueryBuilder for constructing the temporary
contact ids table, but in this commit only at
a surface level: leave buildWhere alone for now.