public static function get_action_events_by_courses(
        $courses = [],
        $timesortfrom = null,
        $timesortto = null,
        $limitnum = 20
    ) {
        $return = [];

        foreach ($courses as $course) {
            $return[$course->id] = self::get_action_events_by_course(
                $course,
                $timesortfrom,
                $timesortto,
                null,
                $limitnum
            );
        }

        return $return;
    }