Add distinct clause to handle relationship double ups