public function process_ltiservice_gradebookservices_lineitem($data) {
        global $DB;
        $data = (object)$data;
        // The coupled lineitems are restored as any other grade item
        // so we will only create the entry in the ltiservice_gradebookservices table.
        // We will try to find a valid toolproxy in the system.
        // If it has been found before... we use it.
        /* cache parent property to account for missing PHPDoc type specification */
        /** @var backup_activity_task $activitytask */
        $activitytask = $this->task;
        $courseid = $activitytask->get_courseid();
        if ($data->typeid != null) {
            if ($ltitypeid = $this->get_mappingid('ltitype', $data->typeid)) {
                $newtypeid = $ltitypeid;
            } else { // If not, then we will call our own function to find it.
                $newtypeid = $this->find_typeid($data, $courseid);
            }
        } else {
            $newtypeid = null;
        }
        if ($data->toolproxyid != null) {
            $ltitoolproxy = $this->get_mappingid('ltitoolproxy', $data->toolproxyid);
            if ($ltitoolproxy && $ltitoolproxy != 0) {
                $newtoolproxyid = $ltitoolproxy;
            } else { // If not, then we will call our own function to find it.
                $newtoolproxyid = $this->find_proxy_id($data);
            }
        } else {
            $newtoolproxyid = null;
        }
        if ($data->ltilinkid != null) {
            $ltilinkid = $this->get_new_parentid('lti');
        } else {
            $ltilinkid = null;
        }
        // If this has not been restored before.
        if ($this->get_mappingid('gbsgradeitemrestored',  $data->id, 0) == 0) {
            $newgbsid = $DB->insert_record('ltiservice_gradebookservices', (object) array(
                    'gradeitemid' => 0,
                    'courseid' => $courseid,
                    'toolproxyid' => $newtoolproxyid,
                    'ltilinkid' => $ltilinkid,
                    'typeid' => $newtypeid,
                    'baseurl' => $data->baseurl,
                    'tag' => $data->tag
            ));
            $this->set_mapping('gbsgradeitemoldid', $newgbsid, $data->gradeitemid);
            $this->set_mapping('gbsgradeitemrestored', $data->id, $data->id);
        }
    }