Refactor relationship syncing