Better still, keep the electronics in there. Just chuck the motor and primary drive, then pick up the motor hall and phase wires and run them to a hub motor. That way, the battery, charger , LCD and torque sensor can still be used.
The only flaw is that it's often the bearings that go, and if...