public function getRelatedLayoutsCount(Layout $sharedLayout): int
    {
        $query = $this->connection->createQueryBuilder();
        $query->select('count(DISTINCT ngbm_layout.id) AS count')
            ->from('ngbm_layout')
            ->innerJoin(
                'ngbm_layout',
                'ngbm_zone',
                'z',
                $query->expr()->andX(
                    $query->expr()->eq('z.layout_id', 'ngbm_layout.id'),
                    $query->expr()->eq('z.status', 'ngbm_layout.status'),
                    $query->expr()->eq('z.linked_layout_id', ':linked_layout_id')
                )
            )
            ->where(
                $query->expr()->andX(
                    $query->expr()->eq('ngbm_layout.shared', ':shared'),
                    $query->expr()->eq('ngbm_layout.status', ':status')
                )
            )
            ->setParameter('shared', false, Type::BOOLEAN)
            ->setParameter('status', Value::STATUS_PUBLISHED, Type::INTEGER)
            ->setParameter('linked_layout_id', $sharedLayout->id, Type::INTEGER);

        $data = $query->execute()->fetchAll(PDO::FETCH_ASSOC);

        return (int) ($data[0]['count'] ?? 0);
    }