public function process_endorsement($data) {
        global $DB;

        $data = (object)$data;

        $params = [
            'badgeid' => $this->get_new_parentid('badge'),
            'issuername' => $data->issuername,
            'issuerurl' => $data->issuerurl,
            'issueremail' => $data->issueremail,
            'claimid' => $data->claimid,
            'claimcomment' => $data->claimcomment,
            'dateissued' => $this->apply_date_offset($data->dateissued)
        ];
        $newid = $DB->insert_record('badge_endorsement', $params);
        $this->set_mapping('endorsement', $data->id, $newid);
    }