Updated code to manage one to many field associations