Compatibility fix in delete function

php 5.3 does not support $object->getArray()['ArrayItem'] notation.