The court may determine any controversy between parties before it when it can be done without prejudice to the rights of others or by saving their rights; but when a determination of the controversy cannot be had without the presence of other parties, the court shall order them to be brought in.

Source