New method to handle the query message