private function getResourceSerializerGroups(string $resourceClass): array
    {
        $serializerClassMetadata = $this->serializerClassMetadataFactory->getMetadataFor($resourceClass);

        $groups = [];
        foreach ($serializerClassMetadata->getAttributesMetadata() as $serializerAttributeMetadata) {
            $groups += array_flip($serializerAttributeMetadata->getGroups());
        }

        return array_keys($groups);
    }