Removes duplicate items from an array in place