Fix counter management in message store cache.
Reconcile outbound messages (and events) before inbound messages.
Merge branch 'feature/issue-844-fix-message-store-counters' into develop