private void onMessageReceived(object sender, int cmd, object properties)
    {
        Logger.Log("ROS Manager received and will handle message for command " + cmd);

        StorybookCommand command = (StorybookCommand)Enum.Parse(typeof(StorybookCommand), cmd.ToString());

        // First need to decode, then do something with it.
        if (this.commandHandlers.ContainsKey(command))
        {
            if (properties == null)
            {
                this.commandHandlers[command].Invoke(null);
            }
            else
            {
                this.commandHandlers[command].Invoke((Dictionary <string, object>)properties);
            }
        }
        else
        {
            // Fail fast! Failure here means StorybookCommand struct is not up to date.
            throw new Exception("Don't know how to handle this command: " + command);
        }
    }
 // Registers a message handler for a particular command the app might receive from the controller.
 public void RegisterHandler(StorybookCommand command, Action <Dictionary <string, object> > handler)
 {
     this.commandHandlers.Add(command, handler);
 }