public async Task <int> RemoveDuplicates() { int counter = Tracks.Count; List <PlayableBase> noduplicates = null; await Task.Run(() => noduplicates = Tracks.Distinct(new TrackComparer()).ToList()); if (noduplicates.Count <= 0 || noduplicates.Count == Tracks.Count) { return(counter - noduplicates.Count); } var duplicateList = Tracks.ToList(); foreach (var noduplicate in noduplicates) { duplicateList.Remove(noduplicate); } foreach (var track in duplicateList) { RemoveTrack(track); } ViewSource.Refresh(); return(counter - noduplicates.Count); }