add method to sort relations