Refactor to use TypeDefinition for attributes and added primitive type support