before saving data to persistant device