ADD Refactor the device registration to allow both config based and provision based registration