/// <summary>
        ///     Binds the data.
        /// </summary>
        private void BindData()
        {
            if (!_bindDataAllowed)
            {
                return;
            }


            var view = cmbView.ParseEnum <View>();

            var        rankFilter = cmbRank.GetTextThreadSafe();
            List <int> ranks;

            switch (rankFilter)
            {
            case "Good+":
                ranks = new List <int> {
                    5, 4, 3
                };
                break;

            case "Bearable+":
                ranks = new List <int> {
                    5, 4, 3, 2
                };
                break;

            case "Unranked":
                ranks = new List <int> {
                    1
                };
                break;

            case "Forbidden":
                ranks = new List <int> {
                    0
                };
                break;

            default:
                ranks = new List <int> {
                    5, 4, 3, 2, 1, 0
                };
                break;
            }

            var keyRankFilter = cmbKeyRank.GetTextThreadSafe();
            int minimumKeyRank;

            switch (keyRankFilter)
            {
            case "Very Good+":
                minimumKeyRank = 4;
                break;

            case "Good+":
                minimumKeyRank = 3;
                break;

            case "Bearable+":
                minimumKeyRank = 2;
                break;

            case "Not Good":
                minimumKeyRank = 0;
                break;

            default:
                minimumKeyRank = -1;
                break;
            }

            List <Track> tracks;

            if (_parentTrack == null)
            {
                tracks = new List <Track>();
            }
            else if (view == View.FromTracks)
            {
                tracks = GetMixableFromTracks(_parentTrack, ranks);
            }
            else
            {
                tracks = GetMixableToTracks(_parentTrack, ranks);
            }


            var playListTracks = new List <Track>();

            if (PlaylistControl != null)
            {
                playListTracks = PlaylistControl.GetTracks();
            }

            if (minimumKeyRank == 0 && _parentTrack != null)
            {
                tracks = tracks
                         .Where(t => KeyHelper.GetKeyMixRank(_parentTrack.Key, t.Key) <= 1)
                         .ToList();
            }
            else if (minimumKeyRank != -1 && _parentTrack != null)
            {
                tracks = tracks
                         .Where(t => KeyHelper.GetKeyMixRank(_parentTrack.Key, t.Key) >= minimumKeyRank)
                         .ToList();
            }

            var mixableTracks = new List <MixableTrackModel>();

            foreach (var track in tracks)
            {
                if (_parentTrack == null)
                {
                    continue;
                }
                if (mixableTracks.Exists(mt => mt.Description == track.Description))
                {
                    continue;
                }
                if (chkExcludeQueued.Checked && playListTracks.Exists(mt => mt != null && mt.Description == track.Description))
                {
                    continue;
                }

                var mixRank = view == View.FromTracks
                    ? _mixLibrary.GetExtendedMixLevel(track, _parentTrack)
                    : _mixLibrary.GetExtendedMixLevel(_parentTrack, track);

                var mixRankDescription = view == View.FromTracks
                    ? _mixLibrary.GetExtendedMixDescription(track, _parentTrack)
                    : _mixLibrary.GetExtendedMixDescription(_parentTrack, track);

                var mixableTrack = new MixableTrackModel
                {
                    Track              = track,
                    Description        = track.Description,
                    Bpm                = track.Bpm,
                    Diff               = BpmHelper.GetAbsoluteBpmPercentChange(_parentTrack.EndBpm, track.StartBpm),
                    MixRank            = mixRank,
                    MixRankDescription = mixRankDescription,
                    Rank               = track.Rank,
                    RankDescription    = track.RankDescription,
                    Key                = KeyHelper.GetDisplayKey(track.Key),
                    KeyDiff            = KeyHelper.GetKeyDifference(_parentTrack.Key, track.Key),
                    KeyRankDescription = KeyHelper.GetKeyMixRankDescription(track.Key, _parentTrack.Key)
                };

                mixableTrack.MixRankDescription =
                    _mixLibrary.GetRankDescription(Convert.ToInt32(Math.Floor(mixableTrack.MixRank)));
                var hasExtendedMix = _mixLibrary.HasExtendedMix(_parentTrack, track);
                if (hasExtendedMix)
                {
                    mixableTrack.MixRankDescription += "*";
                }

                mixableTracks.Add(mixableTrack);
            }

            if (grdMixableTracks.SortedColumn != null)
            {
                var sortField = grdMixableTracks.SortedColumn.DataPropertyName;
                if (sortField == "Description")
                {
                    mixableTracks = mixableTracks.OrderBy(t => t.Description).ToList();
                }
                if (sortField == "BPM")
                {
                    mixableTracks = mixableTracks.OrderBy(t => t.Bpm).ToList();
                }
                if (sortField == "Diff")
                {
                    mixableTracks = mixableTracks.OrderBy(t => t.Diff).ToList();
                }
                if (sortField == "MixRankDescription")
                {
                    mixableTracks = mixableTracks.OrderBy(t => t.MixRank).ThenByDescending(t => t.Diff).ToList();
                }
                if (sortField == "RankDescription")
                {
                    mixableTracks = mixableTracks.OrderBy(t => t.Rank).ThenByDescending(t => t.Diff).ToList();
                }
                if (sortField == "Key")
                {
                    mixableTracks = mixableTracks.OrderBy(t => t.Key).ToList();
                }
                if (sortField == "KeyRankDescription")
                {
                    mixableTracks = mixableTracks.OrderByDescending(t => t.KeyDiff).ToList();
                }

                if (grdMixableTracks.SortOrder == SortOrder.Descending)
                {
                    mixableTracks.Reverse();
                }
            }
            else
            {
                mixableTracks = mixableTracks
                                .OrderByDescending(t => t.MixRank)
                                .ThenBy(t => t.KeyDiff)
                                .ThenBy(t => t.Diff)
                                .ThenByDescending(t => t.Rank)
                                .ThenBy(t => t.Description)
                                .ToList();
            }

            grdMixableTracks.SaveSelectedRows();
            grdMixableTracks.DataSource = mixableTracks;
            grdMixableTracks.RestoreSelectedRows();

            lblCount.Text = $"{mixableTracks.Count} tracks";
        }