protected function getConnectedUserMediaPerimeter($siteId)
    {
        $user = $this->get('security.token_storage')->getToken()->getUser();
        if ($user->hasRole(ContributionRoleInterface::PLATFORM_ADMIN)
            || $user->hasRole(ContributionRoleInterface::DEVELOPER)
        ) {
            return null;
        }

        $userGroups = $user->getGroups();
        $folderIds = array();

        foreach ($userGroups as $group) {
            if ($group->hasRole(MediaContributionRoleInterface::MEDIA_CONTRIBUTOR) && $group->getSite()->getSiteId() == $siteId) {
                foreach ($group->getPerimeter(MediaFolderInterface::ENTITY_TYPE)->getItems() as $path) {
                    foreach ($this->get('open_orchestra_media.repository.media_folder')->findSubTreeByPath($path) as $folder) {
                        $folderIds[$folder->getId()] = $folder->getId();
                    }
                }
            }
        }

        return $folderIds;
    }