This is pretty similar logic to a standard doQuery, could we just delegate to that instead of duplicating?