Update array of object if object exist else insert new object

@geraldss yeah I went through array functions and conditional operators and tried some queries but it didn’t work