If there is a dispute about custody, the court sometimes refers the parents to internal court mediation services. This process gives the parents an opportunity to reach an agreement regarding custody and related issues; however, if the parents are unable to agree on custody, the court will decide for them. Sometimes the court seeks professional advice from outside experts who evaluate the family situation or offer an opinion about custody. In some situations, the court also may order an investigation by a social service or other agency. In every case, the court must decide custody based on a determination of the best interests of the child.