The following code works great in that it finds if I have an element within a nested array. If such an element does not exist the code inserts it.
I'm struggling to find a way to remove an existing element if it already exists so I can then insert an updated version of it.
Perhaps there is even a better way to just update the existing element without removing it first?
if insertSolution.contains(where: { $0.resourceName == name }) {
//remove $0
//insert new resource
print("Already inserted. Update needed!")
} else {
insertSolution.append(solution);
print("New solution. Insert needed!");
}