abstract out logic for registering extensions.