M16 receivers can be repaired pretty easily. As long as the original serial number is not damaged, you can take an M16 that was cut in half and have it repaired.
Now taking the general premise of your question: If it is damaged irreparably, then you are SOL.
You cannot take the original and "replace" it with a new one.
In the past Olympic would replace damaged M16s with a new one that had the same serial number. ATF has stopped that practice.