@classmethod
def first_or_new(cls, **attributes):
    """
        Get the first record matching the attributes or instantiate it.

        :param attributes: The instance attributes
        :type attributes: dict

        :return: The new instance
        :rtype: Model
        """
    instance = cls.where(attributes).first()
    if instance is not None:
        return instance
    return cls(**attributes)
