Add isEmpty method to MessageBag. Closes #1579.
Merge branch '4.0'