Move restore setttings code to its own function. Utilize HashMap to smartly restore device setting.