I have a ShoppingCart model, which hasMany('cartItem'). I want the model to have an addProduct method, that will either update the corresponding cartItem, or create a new one. One approach would be something like the following: