function makeRemoveChain(task, gfs) {
    var removeChain = Promise.resolve();

    task.steps.forEach(function (step) {
      if (step.type !== constants.FILE_REMOVE) return;

      var shadowId = step.dataStore[0].shadow;

      removeChain = removeChain.then(function () {
        return fileExists(shadowId, gfs)
          .then(function (exists) {
            if (!exists) return Promise.resolve();

            return removeFile(shadowId, gfs);
          });
      });
    });

    return removeChain;
  }
Chains together the deletion of shadow files
from file remove steps.

@param task the task to check for shadow files
@param gfs GridFS

@returns {Promise|*}