public static MetaItem[] ToMetaItems(IGalleryObjectMetadataItemCollection metadataItems, IGalleryObject galleryObject)
        {
            var metaItems = new MetaItem[metadataItems.Count];
            var metaDefs = Factory.LoadGallerySetting(galleryObject.GalleryId).MetadataDisplaySettings;
            var moProfiles = ProfileController.GetProfile().MediaObjectProfiles;

            for (int i = 0; i < metaItems.Length; i++)
            {
                IGalleryObjectMetadataItem md = metadataItems[i];

                metaItems[i] = new MetaItem
                    {
                        Id = md.MediaObjectMetadataId,
                        MediaId = galleryObject.Id,
                        MTypeId = (int)md.MetadataItemName,
                        GTypeId = (int)galleryObject.GalleryObjectType,
                        Desc = md.Description,
                        Value = md.Value,
                        IsEditable = metaDefs.Find(md.MetadataItemName).IsEditable
                    };

                if (md.MetadataItemName == MetadataItemName.Rating)
                {
                    ReplaceAvgRatingWithUserRating(metaItems[i], moProfiles);
                }
            }

            return metaItems;
        }
        /// <summary>
        /// When the current user has previously rated an item, replace the average user rating with user's
        /// own rating.
        /// </summary>
        /// <param name="metaItem">The meta item. It must be a <see cref="MetadataItemName.Rating" /> item.</param>
        /// <param name="moProfiles"></param>
        private static void ReplaceAvgRatingWithUserRating(MetaItem metaItem, IMediaObjectProfileCollection moProfiles)
        {
            var moProfile = moProfiles.Find(metaItem.MediaId);

            if (moProfile != null)
            {
                metaItem.Desc = Resources.GalleryServerPro.UC_Metadata_UserRated_Rating_Lbl;
                metaItem.Value = moProfile.Rating;
            }
        }