what is the best way to delete relationship between email address and bean?

https://developer.sugarcrm.com/2011/03/08/howto-add-and-retrieve-email-addresses-in-a-module-thru-code/comment-page-1/#c… provides a good primer on adding email addresses and relating them to a bean.

But what's the best way to delete the relationship between a bean and an email address?

Scenario:

when syncing with another system that contains Contacts and email addresses

remove any addresses that are on the contact but not in the imported record.

If the bean in question is the only one related to that address then also delete the address so as not to leave orphan addresses.

thanks,
FrancescaS