optimizing message query in runtalk-messages controller