public void SaveProperties(PostedDataDto postedData) { string filePath = metadataConfiguration.GetAbsolutePath(postedData.guid); var tempFilePath = GetTempPath(filePath); using (MetadataContext context = new MetadataContext(filePath, postedData.password)) { foreach (var packageInfo in postedData.packages) { context.UpdateProperties(packageInfo.id, packageInfo.properties.Select(p => new Property(p.name, (PropertyType)p.type, p.value))); } context.Save(tempFilePath); } DirectoryUtils.MoveFile(tempFilePath, filePath); }