refactor relationshipsController