save type in db