Remove duplicate objects from an array.