add save data function in the code