public bool RemoveFile(File file)
        {
            File nFile = GetFile(file.Id);
            if (nFile != null)
            {
                IDbFileVersion dbFileVersion = new DbFileVersion();
                bool error = false;
                try
                {
                    var option = new TransactionOptions();
                    option.IsolationLevel = IsolationLevel.ReadCommitted;

                    using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, option))
                    {
                        nFile = GetFile(file.Id);
                        //Delete all file versions related to file
                        bool fv = dbFileVersion.RemoveFileVersionsForFile(file.Id);
                        if (fv)
                        {
                            dbContext.Files.DeleteOnSubmit(nFile);
                            dbContext.SubmitChanges();
                            scope.Complete();
                        }
                        else
                        {
                            scope.Dispose();
                            error = true;
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("File could not be removed. File id: " + nFile.Id + "Error: \n" + e);
                    return false;
                }
                if (error != true)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            return false;
            throw new NotImplementedException();
        }
 public FileController()
 {
     dbContext = DbContext.Instance;
     dbFile = new DbFile();
     dbFileVersion = new DbFileVersion();
 }