it depends on how you’re setup works. i suspect both are fine. some of the inbuilt things need you to ‘new up’ the items in a certain way, before you can use them at all, so that’s why they might create the item first before setting values.
but if you don’t need that that just having a ‘new item’ is fine.
Oh wow, this is golden! Thank you so much for sharing!
Correct me if I am wrong here. But, SaveItem runs after DeserializeCore right? So right now I am running _ticketTypeService.Update twice, if I am using _ticketTypeService.Update in both DeserializeCore and SaveItem, right?
Yes, its actually in the handler after it calls deserialize it will call the save, if and when required***
so yes - i would say you don’t need to call the update/create as part of the deseralize prociess, if you don’t have too. you should just “new” the object if FindItem doesn’t find it, and let the new item be saved by the process deserlizecore.
you only need to call the update/create if you can’t just create a new version of your object with ‘new’ (which sometimes is the case, but mostly, people just do new() right?)
* edge case: for some things the handler can choose to do a bulk save (doesn’t really happen)
* another edge case : you can set the “saved” flag as part of the result, and the handler won’t save it.