How admin of application registered subordinates in realm react native

I building an app who has a admin, admin can registered it’s subordinates as realm app users but subordinates can not registered by themselves. After registering admin team can login in to the app and can take orders from their client. The problem I am facing is when admin is registering a user by this function

export const RegisterUser = async (email, password) => {
    const credentials = Realm.Credentials.emailPassword(email, password);
    try {
        const user = await myapp.emailPasswordAuth.registerUser({email, password});
    } catch (error ) {
        console.log("Error is ", error);

the user is registered in the app users and I also create a trigger function on authentication which update the collection User. I want to relate the app user to the users in the User collection, how can be this acheived because nothing is returned Realm.Credentials.emailPassword so that we take id and save it the collection User.

This is my whole function to register a user

const saveHandler = async () => {

        try {
            const realm = await;
            const ifEmailAlreadyExists = realm.objects("User").filtered(`email == "${username}" `);
            if(ifEmailAlreadyExists.length > 0){
            } else {
                const newUserId = generateRandomId().toString()
                const staffData = {
                    _id: new ObjectId(),
                    firstname: firstname,
                    lastname: lastname,
                    mobile_no: mobileno,
                    role_id: roleId,    
                    email: username,
                    user_id:   ,
                    _partition: "some partition"

                realm.write(() => {
                    realm.create("User", staffData)

                RegisterUser(username, password)
        } catch (err) {
            console.error("Failed to open the realm", err);

First of all I am creating a staff member in the User collection and then hitting RegisterUser function
which is myapp.emailPasswordAuth.registerUser({email, password}) this

Trigger function only works when any staff authenticates first time then my trigger function takes the
and update the by matching the email and update user_id to object id string. I think you are understanding what I am writing here, it’s a multi users app.