Sometimes, iOS users (iPhone, iPad and iPod Touch) may want to reset their devices back to factory settings, just as it was right out of the box. However, this action will turn their current backup into a "nothing-up." A recent Apple Support Note tells how to set up an iPhone as a new device and then restore it to its used state.
The title of the note is How to back up your data and set up as a new device, but the important part is missing: how to get back to where your were before wiping the memory.
First, you have to transfer and backup all your licenses to content. The article presents a bunch of links to relevant articles on this process, I would follow their advice.
Then comes the issue of preserving your backup.
The restore process creates a backup of the device you are restoring. When you select Set Up As New, a sync occurs that writes over your previous backup. To prevent unwanted data loss, you should take steps to preserve the backup created by iTunes.
In iTunes, check Preferences; Devices to check the date and time of your latest backup.
If you do not have a recent backup, create one by right-clicking the device in the source list and choosing Back Up.
Now preserve the latest backup of your data:
Move or copy your current backup from the backup directory into a directory where it will not be overwritten by iTunes (your desktop or home folder, for example).
Ensure that your backup software backs up the backup directory. If you use Mac OS 10.5.5. or later and Time Machine, you may use Time Machine to find a previous backup.
Copy the latest backup to an external disk drive or burn a copy of your backup to a disc.
You must take steps to preserve your backup, or you could lose your personal data when setting up your device as new. This backup is where your SMS and MMS messages and other important personal data are stored.