public function mapLayouts(array $data): array
    {
        $layouts = [];

        foreach ($data as $dataItem) {
            $layoutId = (int) $dataItem['id'];
            $locale = $dataItem['locale'];

            if (!isset($layouts[$layoutId])) {
                $layouts[$layoutId] = [
                    'id' => $layoutId,
                    'type' => $dataItem['type'],
                    'name' => $dataItem['name'],
                    'description' => $dataItem['description'],
                    'created' => (int) $dataItem['created'],
                    'modified' => (int) $dataItem['modified'],
                    'status' => (int) $dataItem['status'],
                    'shared' => (bool) $dataItem['shared'],
                    'mainLocale' => $dataItem['main_locale'],
                ];
            }

            $layouts[$layoutId]['availableLocales'][] = $locale;
        }

        return array_values(
            array_map(
                static function (array $layoutData): Layout {
                    sort($layoutData['availableLocales']);

                    return Layout::fromArray($layoutData);
                },
                $layouts
            )
        );
    }