That $5700 quote is mostly labor, the actual frame should be somewhere in the $1200-$1500 range. You basically have to completely disassemble, then re-assemble on the new frame. It's not difficult, just very time consuming. You could do it yourself if you had a whole garage and lots of time.
You can have any frame repaired but you have to trust the guys doing the work. And it can get expensive if they have to take it apart to do the work for the same reasons, labor.
If you are not a heavy hands on person you might be better served buying something newer. The RZR is a good unit but I can tell you this, no one makes one that is perfect and indestructable. On any off road vehicle if you are buying used it's a buyer beware thing. In that case ask them if it burns oil, dirt and sand through the motor kills the rings. You can easily spend $1-2k on a rebuild depending what else might be damaged (valves...).
Good Luck!