```\nfunction setContractAddress(bytes32 name, address addr) public returns (bool) {\n    require(name > 0x0000000000000000000000000000000000000000000000000000000000000000, "Contract name must not be empty.");\n    require(isAuthorized(msg.sender), "Not authorized to update contract registry.");\n\n    ContractDetails memory info = registry[name];\n    // create info if it doesn't exist in the registry\n    if (info.contractAddress == address(0)) {\n        info = ContractDetails({\n            owner: msg.sender,\n            contractAddress: addr\n        });\n\n        // Update registry indexing\n        contractKeys.push(name);\n   } else {\n        info.contractAddress = addr;\n   }\n    // update record in the registry\n    registry[name] = info;\n\n    emit RegistryUpdated(addr,name);\n\n    return true;\n}\n```\n