private async void PlaylistService_TracksDeleted(PlaylistViewModel playlist)
 {
     // Only update the tracks, if the selected playlist was modified.
     if (this.IsPlaylistSelected && playlist.Equals(this.SelectedPlaylist))
     {
         await this.GetTracksAsync();
     }
 }
        private async Task AddDroppedTracksToHoveredPlaylist(IDropInfo dropInfo)
        {
            if ((dropInfo.Data is TrackViewModel | dropInfo.Data is IList <TrackViewModel>) &&
                dropInfo.TargetItem is PlaylistViewModel)
            {
                try
                {
                    PlaylistViewModel hoveredPlaylist = (PlaylistViewModel)dropInfo.TargetItem;

                    if (hoveredPlaylist.Type.Equals(PlaylistType.Smart))
                    {
                        return; // Don't add tracks to a smart playlist
                    }

                    if (hoveredPlaylist.Equals(this.SelectedPlaylist))
                    {
                        return; // Don't add tracks to the same playlist
                    }

                    var tracks = new List <TrackViewModel>();

                    await Task.Run(() =>
                    {
                        if (dropInfo.Data is TrackViewModel)
                        {
                            // We dropped a single track
                            tracks.Add((TrackViewModel)dropInfo.Data);
                        }
                        else if (dropInfo.Data is IList <TrackViewModel> )
                        {
                            // We dropped multiple tracks
                            foreach (TrackViewModel track in (IList <TrackViewModel>)dropInfo.Data)
                            {
                                tracks.Add(track);
                            }
                        }
                    });

                    await this.playlistService.AddTracksToStaticPlaylistAsync(tracks, hoveredPlaylist.Name);
                }
                catch (Exception ex)
                {
                    LogClient.Error("Could not add dropped tracks to hovered playlist. Exception: {0}", ex.Message);
                }
            }
        }