...
Validate master_person_id UUID
In case of error - return 422
Find person by id in mpi.persons
In case of error - return 422 (Such person doesn't exist404 ( Person not found)
Check person status is active
In case of error - return 409 (Person is not active)
...
Validate merge_person_id UUID
In case of error - return 422
Find preperson by id in mpi.prepersons
In case of error - return 422 (Such preperson doesn't exist404 (Preperson not found)
Check preperson status is active in mpi.prepersons
In case of error - return 409 (Preperson is not active)
Check if exists another preperson merge requests with status NEW or APPROVED for this preperson
if exists - update status of another requests to REJECTED
Check if preperson has at least one episode
if no episodes - return 409 (Preperson has no episodes)
...