Add validation on edit and add.