FAIMS-38 - Fix the database query and the controller for the relationship