Added support to pass queries to automagic methods