Avoid begin/commit in Category::getCountMessage()

Change-Id: I64e4a859a9adf2930265e282f59816c82e1c3070
Merge "Avoid begin/commit in Category::getCountMessage()"