public static function fromContext($context, $ltiResourceLinkId, $tempId = null)
    {

        $resourceLink = new ResourceLink();
        $resourceLink->setContextId($context->getRecordId());
        $resourceLink->context = $context;
        $resourceLink->dataConnector = $context->getDataConnector();
        $resourceLink->ltiResourceLinkId = $ltiResourceLinkId;
        if (!empty($ltiResourceLinkId)) {
            $resourceLink->load();
            if (is_null($resourceLink->id) && !empty($tempId)) {
                $resourceLink->ltiResourceLinkId = $tempId;
                $resourceLink->load();
                $resourceLink->ltiResourceLinkId = $ltiResourceLinkId;
            }
        }

        return $resourceLink;

    }