/// <summary>
        /// Deletes the specified folder and all of its content, by creating a ItemsDeletedChange.
        /// This ItemsDeletedChange is then returned.
        /// </summary>
        /// <param name="path">The path to remove from</param>
        /// <returns>Returns the changes that makes the deletion possible</returns>
        protected ItemsDeletedChange DeleteFolder(string path)
        {
            ItemsDeletedChange itemsDeletion = new ItemsDeletedChange();

            SortedSet<String> entriesFullPaths = VersionSystemFacade.GetEntryPaths(path);

            foreach (var entry in entriesFullPaths)
            {
                string truePath = path + "\\" + entry;
                itemsDeletion.DeleteItem(truePath.Replace("\\\\", "\\"));
            }

            itemsDeletion.DeleteItem(path);

            return itemsDeletion;
        }
        /// <summary>
        /// Moves the specified file, by creating a ItemsDeletedChange (deleting the old file) and a ItemsCreatedChange (creating the file at the new path, with the content).
        /// The two changes is returned inside of a ICollection.
        /// </summary>
        /// <param name="from">The relative path to copy from</param>
        /// <param name="to">The relative path to copy to</param>
        /// <param name="content">The content of the file</param>
        /// <returns>Returns the changes that makes the move possible</returns>
        protected ICollection<AbstractChange> MoveFile(string from, string to, string content)
        {
            ICollection<AbstractChange> returnCollection = new List<AbstractChange>();

            ICreation creation = new FileCreation((to), content.Split('\n'));
            ItemsCreatedChange itemCreation = new ItemsCreatedChange();
            itemCreation.CreateItem(creation);

            ItemsDeletedChange itemDeletion = new ItemsDeletedChange();
            itemDeletion.DeleteItem(from);

            returnCollection.Add(itemCreation);
            returnCollection.Add(itemDeletion);

            return returnCollection;
        }
        /// <summary>
        /// Deletes the current file.
        /// </summary>
        protected void DeleteFile(object sender, EventArgs e)
        {
            ItemsDeletedChange itemDeletion = new ItemsDeletedChange();

            string relativePath = _path.Substring(3);

            itemDeletion.DeleteItem(relativePath);

            var vsc = VersionSystemFacade.GetVersionControlSystem(relativePath);

            if (vsc.Save(itemDeletion) == null)
            {
                Response.Redirect("info.aspx?path=Pie");
            }
            else
            {
                base.ShowWarning();
            }
        }
        /// <summary>
        /// Listens to the renaming of files in the file system.
        /// </summary>
        /// <param name="oldPath">The path to the old file.</param>
        /// <param name="newPath">The path to the new file.</param>
        public void OnRenamed(String oldPath, String newPath)
        {
            // Create the changes
            var created = new ItemsCreatedChange();
            var deleted = new ItemsDeletedChange();

            // Delete the item in the change
            deleted.DeleteItem(oldPath);

            // Create the item
            if (IsDirectory(newPath))
            {
                created.CreateItem(new FolderCreation(newPath));
            }
            else
            {
                // Read the new path on purpose, since the old path no longer exist (the file has been deleted)
                created.CreateItem(new FileCreation(newPath, ReadAllLines(newPath)));
            }

            // Make the cache up to date
            _cache.Delete(oldPath);
            _cache.Update(newPath);

            // Commit
            Commit(new List<AbstractChange> { deleted, created });
        }
        /// <summary>
        /// Listens to deletions of files in the file system.
        /// </summary>
        /// <param name="path">The path to the item that has been deleted</param>
        public void OnDeleted(String path)
        {
            // Create the change
            ItemsDeletedChange change = new ItemsDeletedChange();
            if (IsDirectory(FileSystem.CACHE_DIR + path))
            {
                path = path + ((path.EndsWith(FileSystem.PathSeparator) ? String.Empty : FileSystem.PathSeparator));
                change.DeleteItem(path);
            }
            else
            {
                change.DeleteItem(path);
            }

            // Keep the cache up to date
            _cache.Delete(path);

            Commit(new List<AbstractChange> { change });
        }