[PD-752] Reduced the query count for displaying messages

Before:
![2014-11-04-115408_1703x552_scrot](https://cloud.githubusercontent.com/assets/93686/4903783/2d4d30b8-6443-11e4-845e-db244416b5fc.png)

After:
![2014-11-04-115326_1706x59_scrot](https://cloud.githubusercontent.com/assets/93686/4903791/34c67570-6443-11e4-9f42-f6ae1d389cf6.png)