Tidy up code and extract generation of tag elements to the common code in the ObjectMetadata module.
Factor out duplicate from the object models into common code.