Recovery Partition Backup
What we must do is move the recovery partition after the unallocated partition. There is no direct way of doing this with Windows commands, but what we can do is backup the recovery partition, delete it and then restore it to another partition. We backup the existing recovery partition using the diskpart and dism commands in an elevated command prompt.
First we find the disk that contains the recovery partition and select it.
diskpart
DISKPART> list disk
DISKPART> select disk <disk number>
Next we find the recovery partition, select it and assign a drive letter. We'll use X:
DISKPART> list partition
DISKPART> select partition <recovery partition number>
DISKPART> assign letter=X
DISKPART> exit
So, in my case, I got this
Finally, we copy the recovery partition specifying drive X: as the capture directory.
dism /Capture-Image /ImageFile:C:\recovery.wim /CaptureDir:X:\ /Name:"Recovery"