As a suggestion, why don't you creat a new array and go through each item of your old array and only add it to the new array if it doesn't already exist.