function rollbackRemoveOrUpdate(db, step, task) {
  var collection = getCollectionForStep(db, step);
  var chain = Promise.resolve();

  step.dataStore.forEach(function(data) {
    chain = chain.then(function() {
      var condition = {_id: data._id};

      return collection.findOne(condition).then(function (doc) {
        if (doc && step.type === UPDATE) {
          return collection.updateOne(condition, data);
        }
        else if (!doc && step.type === REMOVE) {
          return collection.insertOne(data);
        }

        return Promise.resolve();
      });
    });
  });

  return chain.then(function(){
    return updateState(task, step.index, ROLLED);
  });
}
Rollback for remove or update step.

@param db native db
@param step the update or remove step
@param task the task containing the step.

@returns {Promise|*}