public static function updateLinks($xref, $ged_id, $gedrec): void
    {
        if (preg_match_all('/^\d+ (' . Gedcom::REGEX_TAG . ') @(' . Gedcom::REGEX_XREF . ')@/m', $gedrec, $matches, PREG_SET_ORDER)) {
            $data = [];
            foreach ($matches as $match) {
                // Include each link once only.
                if (!in_array($match[1] . $match[2], $data, true)) {
                    $data[] = $match[1] . $match[2];
                    try {
                        DB::table('link')->insert([
                            'l_from' => $xref,
                            'l_to'   => $match[2],
                            'l_type' => $match[1],
                            'l_file' => $ged_id,
                        ]);
                    } catch (PDOException $ex) {
                        // Ignore any errors, which may be caused by "duplicates" that differ on case/collation, e.g. "S1" and "s1"
                    }
                }
            }
        }
    }