Take a high res shot of all the wiring in the backbox. Just proceed in order of elimination when connecting everything back. It's quite simple really. Looks like a heep of work but once you start connecting one connector in the right place seems like the rest just fall into place.
Then place the wiring inside the cabinet and unbolt the hinges.