Should we pass foreignTableId to the function, and open/close the relation inside the function?