code: function (aggregate, cmd) {
      if (!aggregate || !_.isObject(aggregate)) {
        var err = new Error('Please pass a valid aggregate!');
        debug(err);
        throw err;
      }
      if (!cmd || !_.isObject(cmd)) {
        var err = new Error('Please pass a valid command!');
        debug(err);
        throw err;
      }
  
      var hasRevision = !!this.definitions.command.revision;
  
      if (!hasRevision) {
        return null;
      }
  
      var revisionInCommand = dotty.get(cmd, this.definitions.command.revision);
      if (revisionInCommand === null || revisionInCommand === undefined) {
        return null;
      }
  
      var contextName, aggregateName, aggregateId;
  
      if (!!this.definitions.command.context) {
        contextName = dotty.get(cmd, this.definitions.command.context);
      }
  
      if (!!this.definitions.command.aggregate) {
        aggregateName = dotty.get(cmd, this.definitions.command.aggregate);
      }
  
      if (!!this.definitions.command.aggregateId) {
        aggregateId = dotty.get(cmd, this.definitions.command.aggregateId);
      }
  
      var streamInfo = {
        context: contextName,
        aggregate: aggregateName,
        aggregateId: aggregateId
      };
  
      if (revisionInCommand === aggregate.getRevision(streamInfo)) {
        return null;
      }
  
      return new AggregateConcurrencyError('Actual revision in command is "' + revisionInCommand + '", but expected is "' + aggregate.getRevision(streamInfo) + '"!', {
        aggregateId: aggregate.id,
        aggregateRevision: aggregate.getRevision(streamInfo),
        commandRevision: revisionInCommand
      });
    }
docs: Returns an error if the revision does not match.
  @param {AggregateModel} aggregate The passed aggregate.
  @param {Object}         cmd       The command.
  @returns {AggregateConcurrencyError}