public void Execute()
        {
            var manager = new iTunesManager();
            if (!manager.Load()) return;

            System.Console.WriteLine(string.Format("iTunes Library Loaded, Processing {0} tracks", manager.TotalTracks));
            System.Console.WriteLine(string.Empty);

            if (_options.UpdateWindowsFiles)
                System.Console.WriteLine("Updating Windows Files from iTunes ...");
            else if (_options.UpdateiTunesFiles)
                System.Console.WriteLine("Updating iTunes from Windows Files ...");

            System.Console.WriteLine(string.Empty);

            while (manager.NextTrack()) {
                ProcessTrack(manager);
            }

            decimal percentCompleted = 0;
            decimal ratedTracks = Convert.ToDecimal(manager.TotalTracks) - Convert.ToDecimal(UnratedTracks);
            if (manager.TotalTracks > 0) percentCompleted = ratedTracks / Convert.ToDecimal(manager.TotalTracks);
            percentCompleted = Math.Round(percentCompleted * 100, 0);

            System.Console.WriteLine(string.Empty);
            System.Console.WriteLine(string.Format("\tTotal Tracks:{0}\tProcessed:{1}\tErrored:{2}\tSkipped:{3}",
                manager.TotalTracks, ProcessedTracks, ErrorTracks, SkippedTracks));
            System.Console.WriteLine(string.Format("\tUpdated:{0}\tRenamed:{1}\tDeleted:{2}\tUnrated:{3}",
                UpdatedTracks, RenamedTracks, DeletedTracks, UnratedTracks));

            System.Console.WriteLine(string.Empty);
            System.Console.WriteLine(string.Format("{0}% of iTunes Library Rated", percentCompleted));
        }
        private void ProcessTrack(iTunesManager manager)
        {
            iTunesFile iTunesTrack = null;

            try
            {
                iTunesTrack = manager.CurrentTrack();
                if (!IsTrackValid(manager, iTunesTrack)) return;

                if (iTunesTrack.Rating == (int)iTunesFile.RatingConstant.One)
                {
                    if (_options.RemoveRatingOneTracks)
                        DeleteTrackAndFile(manager, iTunesTrack);

                    return;
                }

                var windowsFile = new WindowsFile(iTunesTrack.Location);

                if (_options.UpdateWindowsFiles)
                    UpdateWindowsFile(iTunesTrack, windowsFile);
                else if (_options.UpdateiTunesFiles)
                    UpdateiTunesTrack(iTunesTrack, windowsFile);

                if (_options.RenameFiles)
                    RenameWindowsFiles(iTunesTrack, windowsFile);

                if (_options.DisplayInformation)
                    DisplayFileInformaiton(iTunesTrack, windowsFile);

                if (iTunesTrack.Rating == (int)iTunesFile.RatingConstant.Unrated)
                    UnratedTracks++;

                ProcessedTracks++;
            }
            catch (Exception exception)
            {
                if (_options.LogErrorMessages)
                {
                    var location = "Unknown Locaiton";
                    if (null != iTunesTrack) location = iTunesTrack.Location;

                    System.Console.ForegroundColor = ErrorColour;
                    System.Console.WriteLine(string.Format("{0}\t{1}", exception.Message, location));
                    System.Console.ForegroundColor = _defaultColour;
                }

                ErrorTracks++;
            }
        }
        private bool IsTrackValid(iTunesManager manager, iTunesFile iTunesTrack)
        {
            if (null == iTunesTrack)
            {
                SkippedTracks++;
                InvalidIndex(manager.CurrentTrackIndex);
                return false;
            }

            if (!iTunesTrack.IsValidKind())
            {
                SkippedTracks++;
                InvalidTrackKind(iTunesTrack);
                return false;
            }

            if (!iTunesTrack.HasLocation())
            {
                MissingLocation(manager, iTunesTrack);
                return false;
            }

            if (!iTunesTrack.IsValidLocation())
            {
                SkippedTracks++;
                InvalidLocation(manager, iTunesTrack);
                return false;
            }

            if (!iTunesTrack.IsValidExtention())
            {
                SkippedTracks++;
                InvalidExtention(iTunesTrack);
                return false;
            }

            return true;
        }
        private void MissingLocation(iTunesManager manager, iTunesFile iTunesTrack)
        {
            if (!_options.LogInformationMessages)
                return;

            System.Console.ForegroundColor = InformationColour;
            System.Console.WriteLine(string.Format("Removed Track from iTunes (Invalid Location)\t{0}[{1}] : {2}",
                iTunesTrack.Artist, iTunesTrack.Album, iTunesTrack.Title));
            System.Console.ForegroundColor = _defaultColour;

            iTunesTrack.RemoveTrack();
            manager.CurrentTrackIndex--;
        }
        private void DeleteTrackAndFile(iTunesManager manager, iTunesFile iTunesTrack)
        {
            var location = iTunesTrack.Location;

            var deleted = !System.IO.File.Exists(location);
            if (!deleted) deleted = DeleteWindowsFile(location);

            if (!deleted) return;
            iTunesTrack.RemoveTrack();

            System.Console.WriteLine(string.Format("Deleted:\t{0}", location));
            manager.CurrentTrackIndex--;
            DeletedTracks++;
        }