raises an exception if the model cannot be added

def add(self, model):
        """raises an exception if the model cannot be added"""
        def foo(m, p, i):
            if m[i][0].name == model.name:
                raise ValueError("Model already exists")
            return
        # checks if already existing
        self.foreach(foo)
        
        self.append((model,))
        return