def METHOD_NAME(cls, session, account, name, role=None):
    q = (
        session.query(cls)
        .filter(cls.account_id == account.id)
        .filter(cls.name == name)
    )
    role = role or ""
    try:
        obj = q.one()
    except NoResultFound:
        obj = cls(account=account, name=name, canonical_name=role)
        obj.category = Category.METHOD_NAME(
            session,
            namespace_id=account.namespace.id,
            name=role,
            display_name=name,
            type_="folder",
        )
        session.add(obj)
    except MultipleResultsFound:
        log.info(
            "Duplicate folder rows for name {}, account_id {}".format(
                name, account.id
            )
        )
        raise
    return obj