Process each message in a DB transaction

Change-Id: I87f075f6914e4384d16649ca26e1556ea5f4efc2
Merge "Process each message in a DB transaction"