def add_CRUD_pset(pset, sm, model_name):
    """Adds the ServerModel CRUD function to the Primitve Set
    
    Parameters
    ----------
    pset : PrimitiveSet
        the primitive set for adding the controller functions
    sm : ServerModel
        the ServerModel with the CRUD functions
    model_name : str
        the name of the OpenAPI model referring to its CRUD functions in the ServerModel ['cart' | 'pole' | 'direction']
        
    Returns
    -------
    PrimitiveSet
        the primitive set containing the ServerModel's CRUD function
    """
    def pset_cart():
        # cart CRUD functions
        pset.addTerminal(sm.create_cart)
        pset.addTerminal(sm.read_cart)
        pset.addTerminal(sm.update_cart)
        pset.addTerminal(sm.delete_cart)

    def pset_pole():
        # cart CRUD functions
        pset.addTerminal(sm.create_pole)
        pset.addTerminal(sm.read_pole)
        pset.addTerminal(sm.update_pole)
        pset.addTerminal(sm.delete_pole)
        
    options = {
        'cart': pset_cart,
        'pole': pset_pole,
    }

    # add CRUD functions to pset
    options[model_name]()
    return pset