/// <summary>
        /// Main Rename function
        /// </summary>
        public void Rename(BackgroundWorker someWorker, DoWorkEventArgs someRenameEventArgs)
        {
            this.currentWorker          = someWorker;
            this.currentRenameEventArgs = someRenameEventArgs;

            double copiedFileBytesSum = countCopiedFileBytes();

            double copiedBytes = 0;
            //Go through all files and do stuff
//            for (int i = 0; i < this.mediaFiles.Count; i++) {
            List <MediaFile> filesToCheck = new List <MediaFile>(mediaFiles);

            foreach (MediaFile mediaFile in filesToCheck)
            {
                if (renamingCancelled(someWorker, someRenameEventArgs))
                {
                    return;
                }

                if (fileWillBeDeleted(mediaFile))
                {
                    deleteMediaFile(mediaFile);
                }

                //need to set before ie.Rename because it resets some conditions
                bool willBeCopied = mediaFileChangesPartition(mediaFile);

                //if there are files which actually need to be copied since they're on a different drive, only count those for the progress bar status since they take much longer
                setProgress(copiedBytes, copiedFileBytesSum, mediaFile, willBeCopied);

                someWorker.ReportProgress((int)ProgressAtCopyStart);

                bool removeFromSet = notVisibleAfterRenaming(mediaFile);
                //this call will also report progress more detailed by calling ReportSingleFileProgress()
                mediaFile.Rename(someWorker, someRenameEventArgs);
                if (removeFromSet)
                {
                    mediaFiles.Remove(mediaFile);
                }
                //after file is (really) copied, add its size
                if (willBeCopied)
                {
                    copiedBytes += getFilesize(mediaFile);
                }
            }

            if (Helper.ReadBool(ConfigKeyConstants.DELETE_EMPTIED_FOLDERS_KEY))
            {
                //Delete all empty folders code
                Helper.DeleteAllEmptyFolders(Helper.ReadProperty(ConfigKeyConstants.LAST_DIRECTORY_KEY), new List <string>(Helper.ReadProperties(ConfigKeyConstants.EMPTY_FOLDER_CHECK_IGNORED_FILETYPES_KEY)), someWorker, someRenameEventArgs);
            }
            logEndOfRenaming(someRenameEventArgs.Cancel);
        }