Move execution of query from Bucket to Query

@pbadenski