public function unlock(ResourceNode $resourceNode, $code = null)
    {
        //if a code is defined
        if ($accessCode = $resourceNode->getAccessCode()) {
            if (empty($code) || $accessCode !== $code) {
                $this->session->set($resourceNode->getUuid(), false);

                throw new InvalidDataException('Invalid code sent');
            }

            $this->session->set($resourceNode->getUuid(), true);
        }
    }