/// <summary> /// Create a rating count meta item for the <paramref name="galleryObject" /> and persist it to the data store. /// </summary> /// <param name="galleryObject">The gallery object.</param> /// <returns>An instance of <see cref="IGalleryObjectMetadataItem" />.</returns> private static IGalleryObjectMetadataItem CreateRatingCountMetaItem(IGalleryObject galleryObject) { // Create the rating count item, add it to the gallery object, and save. var metaDef = Factory.LoadGallerySetting(galleryObject.GalleryId).MetadataDisplaySettings.Find(MetadataItemName.RatingCount); var metaItems = Factory.CreateMetadataCollection(); var ratingCountItem = Factory.CreateMetadataItem(int.MinValue, galleryObject, null, "0", true, metaDef); metaItems.Add(ratingCountItem); galleryObject.AddMeta(metaItems); Factory.SaveGalleryObjectMetadataItem(ratingCountItem, Utils.UserName); return ratingCountItem; }