private function groupSecurityIdentities(array $sids)
    {
        $groupSids = [];

        if (null === $this->sharingManager) {
            throw new InvalidArgumentException('The "setSharingManager()" must be called before');
        }

        foreach ($sids as $sid) {
            if (IdentityUtils::isValid($sid)) {
                $type = $this->sharingManager->getIdentityConfig($sid->getType())->getType();
                $groupSids[$type][] = $sid->getIdentifier();
            }
        }

        return $groupSids;
    }