creating and handling messages as std::shared_ptr<CMessage>