/// <summary>
        /// Remove any items and their associated tags from the database and add new ones for the files currently in the bag location.
        /// This method can also be used to initialize a newly created bag volume already containing files.
        /// </summary>
        /// <param name="drive"></param>
        public void Resynchronize(string drive)
        {
            drive = drive.ToUpper();
            if (vMan.DiscoveredBagVolumes.Count == 0)
            {
                throw new SynchronizationManagerException("Unable to start synchronization: there are no registered bag volumes.");
            }
            DatabaseOperations dbOp;

            if (!VolumeMountManager.GetInstance().DiscoveredBagVolumes.TryGetValue(drive, out dbOp))
            {
                throw new SynchronizationManagerException("Unable to start synchronization: bag volume is not registered.");
            }
            StopSynchronization(drive);             // Stop synching
            dbOp.TruncateTable("Item");
            dbOp.TruncateTable("ItemTag");

            string        path  = drive + dbOp.BagLocation;
            DirectoryInfo dInfo = new DirectoryInfo(path);

            if (dInfo.Exists)
            {
                foreach (FileInfo fInfo in dInfo.GetFiles())
                {
                    Item fileItem = Helper.GetItemFromFileInfo(fInfo);
                    // Old tag processor
                    //dbOp.InsertItem(fileItem);
                    //dbOp.InsertDefaultItemTag(fileItem);

                    // New meta service
                    MetaService.ProcessItem(fileItem, dbOp);
                }
            }
            else
            {
                throw new SynchronizationManagerException("Bag location does not exist on volume " + drive);
            }
        }
        /// <summary>
        /// Start synchronization of the given bag volume entry
        /// </summary>
        /// <param name="entry"></param>
        public void StartSynchronization(string drive)
        {
            if (!_watchedDrives.ContainsKey(drive))
            {
                if (vMan.DiscoveredBagVolumes.Count == 0)
                {
                    throw new SynchronizationManagerException("Unable to start synchronization: there are no registered bag volumes.");
                }
                FileSystemWatcher  fsw = new FileSystemWatcher();
                DatabaseOperations op;
                if (!vMan.DiscoveredBagVolumes.TryGetValue(drive, out op))
                {
                    throw new SynchronizationManagerException("Unable to start synchronization: bag volume is not registered.");
                }


                fsw.Path = op.BagLocation;
                fsw.EnableRaisingEvents = true;
                _watchedDrives.Add(drive, fsw);

                // Assign event handlers for the FileWathcer on this volume
                #region fsw event handlers
                fsw.Created += (s, e) => {
                    FileInfo  fInfo = new FileInfo(e.FullPath);
                    DriveInfo dInfo = new DriveInfo(fInfo.Directory.Root.Name);
                    MjDebug.Log("Detected new file '" + fInfo.Name + "'");
                    DatabaseOperations dbOp = VolumeMountManager.GetInstance().DiscoveredBagVolumes[dInfo.ToString()];
                    Item fileItem           = Helper.GetItemFromFileInfo(fInfo);
                    if (fileItem != null)
                    {
                        try {
                            // Old tag processor
                            //dbOp.InsertItem(fileItem);
                            //dbOp.InsertDefaultItemTag(fileItem);

                            // New meta service
                            MetaService.ProcessItem(fileItem, dbOp);
                        } catch (SQLiteException ex) {
                            MjDebug.Log("Database reports: \n" + ex.Message);
                        }
                    }
                    else
                    {
                        MjDebug.Log("Fileitem is null");
                    }
                };

                fsw.Deleted += (s, e) => {
                    FileInfo  fInfo = new FileInfo(e.FullPath);
                    DriveInfo dInfo = new DriveInfo(fInfo.Directory.Root.Name);
                    MjDebug.Log("Removed file '" + fInfo.Name + "'");
                    DatabaseOperations tempOp = VolumeMountManager.GetInstance().DiscoveredBagVolumes[dInfo.ToString()];
                    Item fileItem             = Helper.GetItemFromId(fInfo.Name);
                    if (fileItem != null)
                    {
                        try {
                            //tempOp.DeleteItem(fileItem);
                        } catch (SQLiteException ex) {
                            MjDebug.Log("Database reports: \n" + ex.Message);
                        }
                    }
                    else
                    {
                        MjDebug.Log("Fileitem is null");
                    }
                };

                fsw.Renamed += (s, e) => {
                    FileInfo  fInfo    = new FileInfo(e.FullPath);
                    FileInfo  oldfInfo = new FileInfo(e.OldFullPath);
                    DriveInfo dInfo    = new DriveInfo(fInfo.Directory.Root.Name);
                    MjDebug.Log("Renamed file '" + oldfInfo.Name + "' to '" + fInfo.Name + "'");
                    DatabaseOperations dbOp = VolumeMountManager.GetInstance().DiscoveredBagVolumes[dInfo.ToString()];
                    Item fileItem           = Helper.GetItemFromFileInfo(fInfo);
                    Item oldFileItem        = Helper.GetItemFromId(oldfInfo.Name);

                    if (fileItem != null && oldfInfo != null)
                    {
                        try {
                            //dbOp.DeleteItem(oldFileItem);

                            // Old tag processor
                            //dbOp.InsertItem(fileItem);
                            //dbOp.InsertDefaultItemTag(fileItem);

                            // New meta service
                            MetaService.ProcessItem(fileItem, dbOp);
                        } catch (SQLiteException ex) {
                            MjDebug.Log("Database reports: \n" + ex.Message);
                        }
                    }
                    else
                    {
                        MjDebug.Log("Fileitem is null");
                    }
                };
                #endregion
            }
        }