public static function updatePlaces(string $xref, Tree $tree, string $gedrec): void
    {
        preg_match_all('/^[2-9] PLAC (.+)/m', $gedrec, $matches);

        $places = array_unique($matches[1]);

        foreach ($places as $place_name) {
            $place = new Place($place_name, $tree);

            // Calling Place::id() will create the entry in the database, if it doesn't already exist.
            // Link the place to the record
            while ($place->id() !== 0) {
                try {
                    DB::table('placelinks')->insert([
                        'pl_p_id' => $place->id(),
                        'pl_gid'  => $xref,
                        'pl_file' => $tree->id(),
                    ]);
                } catch (PDOException $ex) {
                    // Already linked this place - so presumably also any parent places.
                    break;
                }

                $place = $place->parent();
            }
        }
    }