Add support for saving metadata on queries.

I think it was indentation or a clobber issue, there shouldn't be anything new and I'm not sure why I missed this during the commit...