Can you un-jailbreak an iPhone and keep the existing messages?

I jailbroke my iPhone 5c awhile back and have decided to un-jailbreak it because of issues it has caused. Is there any way to keep messages or photos you've added, I have some important messages I don't want to lose.

Just backup before, then restore & then restore from that backup, using iTunes.