protected function getNode($id, $key = null)
    {
        // Determine which key to get the node base on.
        switch ($key) {
            case 'parent':
                $k = 'parent_id';
                break;

            case 'left':
                $k = 'lft';
                break;

            case 'right':
                $k = 'rgt';
                break;

            default:
                $k = $this->getKeyName();
                break;
        }

        // Get the node data.
        $query = $this->db->getQuery(true)
            ->select($this->getKeyName() . ', parent_id, level, lft, rgt')
            ->from($this->db->quoteName($this->table))
            ->where($k . ' = ' . $id)
            ->limit(1);

        $row = $this->db->getReader($query)->loadObject();

        // Check for no $row returned
        if (empty($row)) {
            throw new NestedHandleException(sprintf('%s::getNode(%d, %s) failed.', get_class($this), $id, $key));
        }

        // Do some simple calculations.
        $row->numChildren = (int) ($row->rgt - $row->lft - 1) / 2;
        $row->width = (int) $row->rgt - $row->lft + 1;

        return $row;
    }