Remove undefined for the data to be saved