API Mapping List of Organizations to Database Organizations

Hello all!

I have been working on an application and I am looking to see if anyone has done something similar before. The idea is get use an API call to get a list of organizations and display them in a repeating group. In the repeating group, we check off the groups we want to sync. Once they are synced they show in another repeating group where they are stored in the database as text.
However, I need to then see synchronized accounts and exclude them from the API list.
Additionally, I need to see if there is a way to map/ match the API organizations to the database organizations.

Let me know if anyone has some ideas or insight! I would love some help!

Here is a screenshot, left side API & right side Database:
image