added a parameter to validate containing the operation type (insert/update)