validate before save to db.