public function getAction($id, $embedded = 0)
    {
        /** @var ResourceNode $resourceNode */
        $resourceNode = $this->om->find(ResourceNode::class, $id);
        if (!$resourceNode) {
            throw new ResourceNotFoundException();
        }

        // gets the current user roles to check access restrictions
        $userRoles = $this->security->getRoles($this->tokenStorage->getToken());
        $accessErrors = $this->restrictionsManager->getErrors($resourceNode, $userRoles);

        if (empty($accessErrors) || $this->manager->isManager($resourceNode)) {
            try {
                $loaded = $this->manager->load($resourceNode, intval($embedded) ? true : false);
            } catch (ResourceNotFoundException $e) {
                return new JsonResponse(['resource_not_found'], 500);
            }

            return new JsonResponse(
                array_merge([
                    // append access restrictions to the loaded node
                    // if any to let know the manager that other user can not enter the resource
                    'accessErrors' => $accessErrors,
                ], $loaded)
            );
        }

        return new JsonResponse($accessErrors, 403);
    }