protected function findOrphanedIds(): array
    {
        $queryBuilder = $this->entityManager->createQueryBuilder();
        $queryBuilder->select('cc.id AS id')
                     ->from(CraftingCategory::class, 'cc')
                     ->leftJoin('cc.machines', 'm')
                     ->leftJoin('cc.recipes', 'r')
                     ->andWhere('m.id IS NULL')
                     ->andWhere('r.id IS NULL');

        $result = [];
        foreach ($queryBuilder->getQuery()->getResult() as $data) {
            $result[] = (int) $data['id'];
        }
        return $result;
    }