private static function getEntityId(
        $stringOrEntity,
        string $idSerializedKey
    ) {
        if (!is_array($stringOrEntity)) {
            return $stringOrEntity;
        }

        return $stringOrEntity[$idSerializedKey] ?? null;
    }