Added utility method to convert a query into a state to push the data back into kairos.