public void CleanMetadata(PostedDataDto postedData) { string filePath = metadataConfiguration.GetAbsolutePath(postedData.guid); var tempFilePath = GetTempPath(filePath); using (MetadataContext context = new MetadataContext(filePath, postedData.password)) { context.Sanitize(); context.Save(tempFilePath); } DirectoryUtils.MoveFile(tempFilePath, filePath); }