private function updateBlockTranslations(
        BlockDefinitionInterface $blockDefinition,
        PersistenceBlock $persistenceBlock,
        APIBlockUpdateStruct $blockUpdateStruct
    ): PersistenceBlock {
        if ($blockUpdateStruct->locale === $persistenceBlock->mainLocale) {
            $persistenceBlock = $this->blockHandler->updateBlockTranslation(
                $persistenceBlock,
                $blockUpdateStruct->locale,
                BlockTranslationUpdateStruct::fromArray(
                    [
                        'parameters' => iterator_to_array(
                            $this->parameterMapper->serializeValues(
                                $blockDefinition,
                                $blockUpdateStruct->getParameterValues(),
                                $persistenceBlock->parameters[$persistenceBlock->mainLocale]
                            )
                        ),
                    ]
                )
            );
        }

        $untranslatableParams = iterator_to_array(
            $this->parameterMapper->extractUntranslatableParameters(
                $blockDefinition,
                $persistenceBlock->parameters[$persistenceBlock->mainLocale]
            )
        );

        $localesToUpdate = [$blockUpdateStruct->locale];
        if ($persistenceBlock->mainLocale === $blockUpdateStruct->locale) {
            $localesToUpdate = $persistenceBlock->availableLocales;

            // Remove the main locale from the array, since we already updated that one
            $mainLocaleOffset = array_search($persistenceBlock->mainLocale, $persistenceBlock->availableLocales, true);
            if (is_int($mainLocaleOffset)) {
                array_splice($localesToUpdate, $mainLocaleOffset, 1);
            }
        }

        foreach ($localesToUpdate as $locale) {
            $params = $persistenceBlock->parameters[$locale];

            if ($locale === $blockUpdateStruct->locale) {
                $params = iterator_to_array(
                    $this->parameterMapper->serializeValues(
                        $blockDefinition,
                        $blockUpdateStruct->getParameterValues(),
                        $params
                    )
                );
            }

            $persistenceBlock = $this->blockHandler->updateBlockTranslation(
                $persistenceBlock,
                $locale,
                BlockTranslationUpdateStruct::fromArray(
                    [
                        'parameters' => $untranslatableParams + $params,
                    ]
                )
            );
        }

        return $persistenceBlock;
    }