protected function _afterSelect(DatabaseContext $context)
    {
        if(!$context->query->isCountQuery())
        {
            $rowset = ObjectConfig::unbox($context->data);

            if ($rowset instanceof DatabaseRowsetInterface)
            {
                //Store the nodes
                $this->__nodes    = $rowset;
                $this->__iterator = null;
                $this->__children = array();

                foreach ($this->__nodes as $key => $row)
                {
                    //Force mixin the behavior into each row
                    $row->mixin($this);

                    if($row->isRecursable()) {
                        $parent = (int) $row->getProperty($this->_parent_column);
                    } else {
                        $parent = 0;
                    }

                    //Store the nodes by parent
                    $this->__children[$parent][$key] = $row;
                }

                //Sort the children
                ksort($this->__children);
            }
        }
    }