implementing messages restoration