Trim string values before writing them to the db.