Issue #30 : cleanup code for messages. Avoid code duplication by moving code to BaseController.

Signed-off-by: Ah-Lun Tang <tang@ahlun.be>