public function calculateCoordinatesForAllRecordsInTable($addWhereClause = ''): int
    {
        $tableName = 'tt_address';
        $latitudeField = 'latitude';
        $longitudeField = 'longitude';
        $streetField = 'address';
        $zipField = 'zip';
        $cityField = 'city';
        $countryField = 'country';

        // Fetch all records without latitude/longitude
        $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($tableName);
        $queryBuilder = $connection->createQueryBuilder();
        $queryBuilder->getRestrictions()
            ->removeAll()
            ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
        $queryBuilder
            ->select('*')
            ->from($tableName)
            ->where(
                $queryBuilder->expr()->orX(
                    $queryBuilder->expr()->isNull($latitudeField),
                    $queryBuilder->expr()->eq($latitudeField, $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)),
                    $queryBuilder->expr()->eq($latitudeField, 0.00000000000),
                    $queryBuilder->expr()->isNull($longitudeField),
                    $queryBuilder->expr()->eq($longitudeField, $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)),
                    $queryBuilder->expr()->eq($longitudeField, 0.00000000000)
                )
            )
            ->setMaxResults(500);
        if (!empty($addWhereClause)) {
            $queryBuilder->andWhere(QueryHelper::stripLogicalOperatorPrefix($addWhereClause));
        }
        $records = $queryBuilder->execute()->fetchAll();
        if (\count($records) > 0) {
            foreach ($records as $record) {
                $country = $record[$countryField];

                // do the geocoding
                if (!empty($record[$zipField]) || !empty($record[$cityField])) {
                    $coords = $this->getCoordinatesForAddress($record[$streetField], $record[$zipField], $record[$cityField], $country);
                    if ($coords) {
                        // Update the record to fill in the latitude and longitude values in the DB
                        $connection->update(
                            $tableName,
                            [
                                $latitudeField => $coords['latitude'],
                                $longitudeField => $coords['longitude'],
                            ],
                            [
                                'uid' => $record['uid']
                            ]
                        );
                    }
                }
            }
        }
        return \count($records);
    }