public function alterQueryBuilderWithParentRoot($query, $parent_id, $include_parent = true)
    {
        if (is_null($parent_id)) {
            return $query;
        }
        $parent = $this->find($parent_id);

        $query->andWhere(
            $query->getRootAliases()[0] . '.lft >=' . $this->addNamedParameter('lft', $parent->getLft(), $query)
            . ' AND ' .
            $query->getRootAliases()[0] . '.lft <=' . $this->addNamedParameter('rgt', $parent->getRgt(), $query)
        );
        if (!$include_parent) {
            $query->andWhere(
                $query->getRootAliases()[0] . '.id !=' . $this->addNamedParameter('id', $parent_id, $query)
            );
        }
        return $query;
    }