start of writing restore data to local db