You want to implement cross-field validation
The problem
The solution
Parent topic:
Coding service-layer implementations