Helper method for synchronous query