Added helper method to pre build query based on request