Use this tool to backup your device and restore it from a backup using libimobiledevice so you don’t have to execute to time consuming code.