code: function beforeRemoveMany_(attr, event, callback) {
      try {
          if (event.state !== 4) { return callback(); }
          var context = event.model.context,
              name = attr.property || attr.name;
          var nestedModel = context.model(attr.type);
          if (_.isNil(nestedModel)) { return callback(); }
          //get junction
          var junction = event.target.property(name);
          //select object identifiers (get all objects in silent mode to avoid orphaned objects)
          junction.select(nestedModel.getPrimaryKey()).silent().all().then(function(result) {
              //first of all remove all associations
              junction.clear(function(err) {
                  if (err) { return callback(err); }
                  //and afterwards remove nested objects
                  nestedModel.silent().remove(result, function(err) {
                      if (err) { return callback(); }
                  });
              });
          }).catch(function(err) {
             return callback(err);
          });
      }
      catch (err) {
          callback(err)
      }
  }
docs: eslint-disable-next-line no-unused-vars