How to check whether an account already exists in Moralis Users

I need to check whether an account already exists in Moralis Users.
This issue is when our app is trying to link the account with another that already exists in Moralis User. I need to prevent linking when account already exists.
image

you can use a cloud function where you can use master key to check that

Thank you @cryptokid for replying, Can you explain your solution little bit more?

you create a cloud function, then you call that could function in front end

https://docs.moralis.io/moralis-server/cloud-code/cloud-functions