This looks like it should resolve my issue.
Is there any way of passing the two field keys into the function or will I need to create an entire function for each bidirectional relationship I have since the keys are only set within the function itself?
Thank you for all your help!