[CA-152000] Failed to enumerate values being deleted

While enumerating over values, deleting a value invalidates the current
index. Implement a delete-if-condition is met function to delete values
during an enumeration of these values.

Signed-off-by: Owen Smith <owen.smith@citrix.com>