protected function process_entries(array $entries) {
        global $OUTPUT;

        $dirslist   = [];
        $fileslist  = [];
        foreach ($entries as $entry) {
            $entrydata = $entry;
            if (isset($entrydata->metadata)) {
                // If this is metadata, fetch the metadata content.
                // We only use the consistent parts of the file, folder, and metadata.
                $entrydata = $entrydata->metadata;
            }
            if ($entrydata->{".tag"} === "folder") {
                $dirslist[] = [
                        'title'             => $entrydata->name,
                        // Use the display path here rather than lower.
                        // Dropbox is case insensitive but this leads to more accurate breadcrumbs.
                        'path'              => file_correct_filepath($entrydata->path_display),
                        'thumbnail'         => $OUTPUT->image_url(file_folder_icon(64))->out(false),
                        'thumbnail_height'  => 64,
                        'thumbnail_width'   => 64,
                        'children'          => array(),
                    ];
            } else if ($entrydata->{".tag"} === "file") {
                $fileslist[] = [
                        'title'             => $entrydata->name,
                        // Use the path_lower here to make life easier elsewhere.
                        'source'            => $entrydata->path_lower,
                        'size'              => $entrydata->size,
                        'date'              => strtotime($entrydata->client_modified),
                        'thumbnail'         => $OUTPUT->image_url(file_extension_icon($entrydata->path_lower, 64))->out(false),
                        'realthumbnail'     => $this->get_thumbnail_url($entrydata),
                        'thumbnail_height'  => 64,
                        'thumbnail_width'   => 64,
                    ];
            }
        }

        $fileslist = array_filter($fileslist, array($this, 'filter'));

        return array_merge($dirslist, array_values($fileslist));
    }