<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create(cls, changes, ref, excluded_categories=set()):
 """Create a new change in all queues. :param changes: the change types, an iterable containing :class:`ChangeType` :param ref: the object reference (returned by `obj_ref`) of the changed object :param excluded_categories: set of categories (IDs) whose items will not be tracked """

        ref = dict(ref)
        obj = obj_deref(ref)

        if isinstance(obj, Category):
            if any(c.id in excluded_categories for c in obj.chain_query):
                return
        else:
            event = obj if isinstance(obj, Event) else obj.event
            if event.category not in g.setdefault('livesync_excluded_categories_checked', {}):
                g.livesync_excluded_categories_checked[event.category] = excluded_categories & set(event.category_chain)
            if g.livesync_excluded_categories_checked[event.category]:
                return

        try:
            agents = g.livesync_agents
        except AttributeError:
            agents = g.livesync_agents = LiveSyncAgent.query.all()

        for change in changes:
            for agent in agents:
                entry = cls(agent=agent, change=change, **ref)
                db.session.add(entry)

        db.session.flush()