Refactored: removed unnecessary early return and added documentation
Corrected error message when attaching a registry with an id already used.
Fixed merge conflict