Improve has method for nested relations