validates before save