public static function create_from_object($choiceanswer, $choice, $cm, $course) {
        global $USER;
        $eventdata = array();
        $eventdata['objectid'] = $choiceanswer->id;
        $eventdata['context'] = \context_module::instance($cm->id);
        $eventdata['userid'] = $USER->id;
        $eventdata['courseid'] = $course->id;
        $eventdata['relateduserid'] = $choiceanswer->userid;
        $eventdata['other'] = array();
        $eventdata['other']['choiceid'] = $choice->id;
        $eventdata['other']['optionid'] = $choiceanswer->optionid;
        $event = self::create($eventdata);
        $event->add_record_snapshot('course', $course);
        $event->add_record_snapshot('course_modules', $cm);
        $event->add_record_snapshot('choice', $choice);
        $event->add_record_snapshot('choice_answers', $choiceanswer);
        return $event;
    }