public void ProcessErrors(Track track)
        {
            var meta = track.Meta.Where(x => x.Text.IsNotEmpty()).ToList().
                Where(v => v.Text.IsTrainerGuitar() || v.Text.IsTrainerBass()).ToList();
            if (meta.Any())
            {
                var nullEvents = meta.Where(t => t.Text.GetTrainerEventIndex().IsNull()).ToList();

                track.Remove(nullEvents);

                if (track.Name.IsGuitarTrackName())
                {
                    var bt = meta.Where(v => v.Text.IsTrainerBass()).ToList();
                    if (bt.Any())
                    {
                        track.Remove(bt);
                    }
                }
                else
                {
                    if (track.Name.IsBassTrackName())
                    {
                        var gt = meta.Where(v => v.Text.IsGuitarTrackName()).ToList();
                        if (gt.Any())
                        {
                            track.Remove(gt);
                        }
                    }
                }
            }
        }
        IEnumerable<Data1ChannelEventList> checkForInvalidNotes(GuitarMessageList owner, Track track, IEnumerable<int> data1List)
        {
            var ret = new List<Data1ChannelEventList>();
            try
            {
                var notesOnData2Zero = track.ChanMessages.Where(x => x.Data2 == 0 && x.Command == ChannelCommand.NoteOn).ToList();
                if (notesOnData2Zero.Any())
                {
                    track.Remove(notesOnData2Zero);

                    foreach (var x in notesOnData2Zero)
                    {
                        track.Insert(x.AbsoluteTicks, new ChannelMessage(ChannelCommand.NoteOff, x.Data1, 0, x.Channel));
                    }
                }

                if (track.Name.IsGuitarTrackName6())
                {
                    var bassTrainers = track.Meta.Where(x => x.Text.IsTrainerBass()).ToList();
                    var guitarTrainers = track.Meta.Where(x => x.Text.IsTrainerGuitar()).ToList();

                    if (bassTrainers.Any())
                    {
                        bassTrainers.ForEach(x => track.Remove(x));
                    }
                }

                if (track.Name.IsBassTrackName6())
                {
                    var bassTrainers = track.Meta.Where(x => x.Text.IsTrainerBass()).ToList();

                    var guitarTrainers = track.Meta.Where(x => x.Text.IsTrainerGuitar()).ToList();
                    if (guitarTrainers.Any())
                    {
                        guitarTrainers.ForEach(x => track.Remove(x));
                    }
                }

                ret.AddRange(track.GetCleanMessageList(data1List, owner));

            }
            catch (Exception ex)
            {
                ex.Message.OutputDebug();
            }

            return ret;
        }
        private void UpdateTrack(Track track)
        {
            try
            {

                TrackProperties.FirstOrDefault(x => x.Track == track).IfObjectNotNull(trackProp =>
                {

                    if (trackProp.Track.ChanMessages.Count() > 5)
                    {

                        if (!trackProp.Scale.IsNull())
                        {
                            track.Remove(track.ChanMessages.ToList());

                            var ev = trackProp.Events.Chords.ToList();

                            var scale = trackProp.Scale;
                            if (scale < 0.001)
                                scale = 0.001;

                            var offset = trackProp.Offset;

                            var firstTime = ev.First().TimePair;
                            var firstTick = ev.First().TickPair;

                            ev.ForEach(x =>
                            {
                                x.Notes.ForEach(n =>
                                {
                                    var scaledLength = x.TimeLength * scale;
                                    var scaledStart = (x.StartTime - firstTime.Down) * scale + offset;

                                    var downTick = EditorPro.GuitarTrack.TimeToTick(scaledStart);
                                    var upTick = EditorPro.GuitarTrack.TimeToTick(scaledStart + scaledLength);
                                    var data1 = Utility.GetStringLowE(GuitarDifficulty.Expert) + n.NoteString;
                                    track.Insert((int)(downTick), new ChannelMessage(ChannelCommand.NoteOn, data1, n.NoteFretDown + 100, n.Channel));
                                    track.Insert((int)(upTick), new ChannelMessage(ChannelCommand.NoteOff, data1, 0, n.Channel));
                                });
                            });

                        }
                    }

                });
            }
            catch { }
        }