def registry(db, term=None):
    orgs = []
    with db.connect() as session:
        if term:
            orgs = session.query(Organization).\
                filter(Organization.name.like('%' + term + '%')).\
                order_by(Organization.name).all()
            if not orgs:
                raise NotFoundError(entity=term)
        else:
            orgs = session.query(Organization).\
                order_by(Organization.name).all()
        session.expunge_all()
    return orgs