private function get_index_data($mailbox, $sort_field, $sort_order, $mbox_data = array())
    {
        if (empty($mbox_data)) {
            $mbox_data = $this->imap->folder_data($mailbox);
        }

        if ($mbox_data['EXISTS']) {
            // fetch sorted sequence numbers
            $index = $this->imap->index_direct($mailbox, $sort_field, $sort_order);
        }
        else {
            $index = new rcube_result_index($mailbox, '* SORT');
        }

        return $index;
    }