protected function after_delete($result) {
        global $DB;
        if (!$result) {
            return;
        }

        // Resolving sortorder holes left after delete.
        $table = '{' . self::TABLE . '}';
        $sql = "UPDATE $table SET sortorder = sortorder -1  WHERE  competencyframeworkid = ? AND parentid = ? AND sortorder > ?";
        $DB->execute($sql, array($this->get('competencyframeworkid'), $this->get('parentid'), $this->get('sortorder')));
    }