code: function (cmd) {
      if (!cmd || !_.isObject(cmd)) {
        var err = new Error('Please pass a valid command!');
        debug(err);
        throw err;
      }
  
      var aggregateId = null;
      if (dotty.exists(cmd, this.definition.aggregateId)) {
        aggregateId = dotty.get(cmd, this.definition.aggregateId);
      } else {
        debug('no aggregateId found, seems to be for a new aggregate');
      }
  
      var name = dotty.get(cmd, this.definition.name);
  
      var version = 0;
      if (dotty.exists(cmd, this.definition.version)) {
        version = dotty.get(cmd, this.definition.version);
      } else {
        debug('no version found, handling as version: 0');
      }
  
      var aggregate = null;
      if (dotty.exists(cmd, this.definition.aggregate)) {
        aggregate = dotty.get(cmd, this.definition.aggregate);
      } else {
        debug('no aggregate found, will lookup in all aggregates');
      }
  
      var context = null;
      if (dotty.exists(cmd, this.definition.context)) {
        context = dotty.get(cmd, this.definition.context);
      } else {
        debug('no aggregateName found, will lookup in all contexts');
      }
  
      return {
        name: name,
        aggregateId: aggregateId,
        version: version,
        aggregate: aggregate,
        context: context
      };
    }
docs: Returns the target information of this command.
  @param {Object} cmd The passed command.
  @returns {{name: 'commandName', aggregateId: 'aggregateId', version: 0, aggregate: 'aggregateName', context: 'contextName'}}