added foreach support for querybuilder