Some hints on manipulating profile data

Hey all,

I have some custom profile fields (Profile Manager) for all my users and I want to bulk modify them.

First step is to delete all the data in these fields. Then I will repopulate it based on the email value for a user. I am trying to find some information on the structure of the data based on the profiles with the idea to write some SQL to do the job. 

I see all the data in elgg_users_entity and the profile data in elgg_metastrings, just can't work out the data relationship.

Any hints ?