public function beforeInsert(&$args) {
        $model = $args[0];
        $data = &$args[1];
        foreach ($this->_relationConfig as $foreignModel => $modelRelationConfig) {
            $foreignKey = $modelRelationConfig[self::FOREIGN_KEY_COLUMN_KEY];
            // only act if the foreign key column is filled
            if (!empty($data[$foreignKey])) {
                $maxWeight = $this->findHighestWeight($model, $data[$foreignKey], $modelRelationConfig);
                $data[$modelRelationConfig[self::WEIGHT_COLUMN_KEY]] = ($maxWeight+1);
            }
        }
    }