Application without login required to enter app

Hello! I am currently working on an application that can be opened without the need to login at first.

On fresh install the user navigates from the OnboardingScreen to AppScreen where he can start using it.
The main functionality is that the app fetches some questions from server and the user can answer them.

My need is to save the output of the questions results (if he answered correct/wrong, questionId etc.) and some bookmarks so he can have a list of the Bookmarked questions.

Now when the user logs in to his account (Facebook/Apple/Google) he can sync with Atlas and push the results to mongoDB.

Then if he logout again he will be able to continue using the application locally on his device and on re-login he will sync local data with cloud.

The first problem that I’ve encounter was <UserProvider fallback={}> which I cannot bypass if I don’t have a user.

To bypass fallback I first create an anonymous user:

    const credentials = Credentials.anonymous();
    await app.logIn(credentials);

and then I redirect to AppScreen.

Because I do not want to sync anonymous user to Atlas I disable sync by
realm.syncSession.pause();
My question is how I can now login with Google (for the sake of this example) and migrate anonymous user data to the authenticated and sync with Atlas.

My schemas for Statistics and Bookmarks are those:

class StatisticsClass extends Realm.Object<StatisticsClass> {
  name!: string;
  _id!: BSON.ObjectId;
  owner_id!: string;
  questionId!: string;
  numberOfCorrectAnswers!: number;
  catalogueId!: string;
  timestamp!: number;
  primaryKey!: string;

  static schema: ObjectSchema = {
    name: STATISTICS_SCHEMA_NAME,
    primaryKey: '_id',
    properties: {
      _id: {type: 'objectId', default: () => new BSON.ObjectId()},
      owner_id: 'string',
      questionId: 'string',
      numberOfCorrectAnswers: 'int',
      timestamp: 'int',
      catalogueId: 'string',
    },
  };
}
class BookmarkClass extends Realm.Object<BookmarkClass> {
  name!: string;
  _id!: BSON.ObjectId;
  owner_id!: string;
  id!: string;
  questionid!: string;
  questionText!: string;

  static schema: ObjectSchema = {
    name: BOOKMARK_SCHEMA_NAME,
    primaryKey: '_id',
    properties: {
      _id: {type: 'objectId', default: () => new BSON.ObjectId()},
      owner_id: 'string',
      id: 'string',
      questionid: 'string',
      questionText: 'string',
    },
  };
}

This is the error that I get when I try to sync realm from anonymous user to authenticate user e.g. Google:

SyncError: Client attempted a write that is outside of permissions or query filters; it has been reverted

For anyone who might have the same problem the fix that solved this problem is to link user identities so all the users can bundle together
Cursor_and_Users___App_Services