public function send_message($eventdata) {
        global $DB;

        // Prevent users from getting popup notifications from themselves (happens with forum notifications).
        if ($eventdata->userfrom->id != $eventdata->userto->id && $eventdata->notification) {
            if (!$DB->record_exists('message_popup_notifications', ['notificationid' => $eventdata->savedmessageid])) {
                $record = new stdClass();
                $record->notificationid = $eventdata->savedmessageid;

                $DB->insert_record('message_popup_notifications', $record);
            }
        }

        return true;
    }