public function get_component_comments_since($course, $context, $component, $since, $cm = null) {
        global $DB;

        $commentssince = array();
        $where = 'contextid = ? AND component = ? AND timecreated > ?';
        $comments = $DB->get_records_select('comments', $where, array($context->id, $component, $since));
        // Check item by item if we have permissions.
        $managersviewstatus = array();
        foreach ($comments as $comment) {
            // Check if the manager for the item is cached.
            if (!isset($managersviewstatus[$comment->commentarea]) or
                    !isset($managersviewstatus[$comment->commentarea][$comment->itemid])) {

                $args = new stdClass;
                $args->area      = $comment->commentarea;
                $args->itemid    = $comment->itemid;
                $args->context   = $context;
                $args->course    = $course;
                $args->client_id = 0;
                $args->component = $component;
                if (!empty($cm)) {
                    $args->cm = $cm;
                }

                $manager = new comment($args);
                $managersviewstatus[$comment->commentarea][$comment->itemid] = $manager->can_view();
            }

            if ($managersviewstatus[$comment->commentarea][$comment->itemid]) {
                $commentssince[$comment->id] = $comment;
            }
        }
        return $commentssince;
    }