Move the message registration for ThreadStore to a separate file.

* Solve the circular dependency issue.
* Takes ThreadStore registration out of the MessageStore file.