def fields_to_dict(self):
        """Transform the object to a dict and return the dict."""
        d = {}
        for container in FieldsContainer.class_container.values():
            fields = getattr(self, container)
            if fields:
                d[container] = [field.to_dict() for field in fields]
        return d
Transform the object to a dict and return the dict.