public function getTopTagIds(array $sourceIds = [], int $limit = null, bool $withCount = false): array
    {
        /** @var Model $model */
        $model = $this->framework->getAdapter(Model::class);

        $tagIds = $model->getRelatedValues($this->sourceTable, $this->sourceField, $sourceIds);
        $tagIds = \array_map('intval', $tagIds);

        if (0 === \count($tagIds)) {
            return [];
        }

        $helper = [];

        // Create the helper array with tag occurrences
        foreach ($tagIds as $tagId) {
            ++$helper[$tagId];
        }

        // Sort the helper array descending
        \arsort($helper);

        // Strip the count data
        if (!$withCount) {
            $helper = \array_keys($helper);
        }

        return \array_slice($helper, 0, $limit, $withCount);
    }