public function get_resourcelink_from_context(Context $context) {
        global $DB;

        $resourcelink = null;
        if ($resourcelinkrecord = $DB->get_record($this->resourcelinktable, ['contextid' => $context->getRecordId()],
            'ltiresourcelinkkey')) {
            $resourcelink = ResourceLink::fromContext($context, $resourcelinkrecord->ltiresourcelinkkey);
        }

        return $resourcelink;
    }