Add validation for update and insert