public function findRelatedSourceRecords(int $sourceId, int $limit = null): array
    {
        /** @var Relations $relations */
        $relations = $this->framework->getAdapter(Relations::class);

        if (false === ($relation = $relations->getRelation($this->sourceTable, $this->sourceField))) {
            throw new \RuntimeException(\sprintf('The field %s.%s is not related', $this->sourceTable, $this->sourceField));
        }

        /** @var Model $relationsModel */
        $relationsModel = $this->framework->getAdapter(Model::class);

        $tagIds = $relationsModel->getRelatedValues($this->sourceTable, $this->sourceField, $sourceId);
        $tagIds = \array_values(\array_unique($tagIds));
        $tagIds = \array_map('intval', $tagIds);

        // Return if there are no tags
        if (0 === \count($tagIds)) {
            return [];
        }

        $query = \sprintf(
            'SELECT %s, COUNT(*) AS relevance FROM %s WHERE %s IN (%s) AND %s != ? GROUP BY %s ORDER BY relevance DESC',
            $relation['reference_field'],
            $relation['table'],
            $relation['related_field'],
            \implode(',', $tagIds),
            $relation['reference_field'],
            $relation['reference_field']
        );

        // Set the limit
        if ($limit > 0) {
            $query .= \sprintf(' LIMIT %s', $limit);
        }

        $related = [];

        // Generate the related records
        foreach ($this->db->fetchAll($query, [$sourceId]) as $record) {
            $related[$record[$relation['reference_field']]] = [
                'total' => \count($tagIds),
                'found' => $record['relevance'],
                'prcnt' => ($record['relevance'] / \count($tagIds)) * 100,
            ];
        }

        return $related;
    }