private static void RebuildMetaItem(IMetadataDefinition metaDef, IGalleryObject galleryObject, string userName) { galleryObject.ExtractMetadata(metaDef); IGalleryObjectMetadataItem metaItem; if (galleryObject.MetadataItems.TryGetMetadataItem(metaDef.MetadataItem, out metaItem)) { Factory.SaveGalleryObjectMetadataItem(metaItem, userName); } if (galleryObject.GalleryObjectType == GalleryObjectType.Album) { foreach (var go in galleryObject.GetChildGalleryObjects()) { RebuildMetaItem(metaDef, go, userName); } } }