static public function updateOrCreateRecords(array $records) {
        $table = static::getInstance();
        $alreadyInTransaction = $table::inTransaction();
        if (!$alreadyInTransaction) {
            $table::beginTransaction();
        }
        try {
            foreach ($records as $record) {
                $success = $table::updateOrCreateRecord($record);
                if (!$success) {
                    if (!$alreadyInTransaction) {
                        $table::rollBackTransaction();
                    }
                    return false;
                }
            }
            if (!$alreadyInTransaction) {
                $table::commitTransaction();
            }
            return true;
        } catch (\Exception $exc) {
            if (!$alreadyInTransaction && $table::inTransaction()) {
                $table::rollBackTransaction();
            }
            /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
            throw $exc;
        }
    }