move queryhelper pattern into utils module