public IActionResult PutGalleryItemMeta(Entity.GalleryItemMeta galleryItemMeta)
        {
            // PUT /api/galleryitemmeta
            try
            {
                _metadataController.SaveGalleryItemMeta(galleryItemMeta);

                if (galleryItemMeta.ActionResult == null)
                {
                    galleryItemMeta.ActionResult = new Business.ActionResult()
                    {
                        Status = ActionResultStatus.Success.ToString(),
                        Title  = "Save successful"
                    };
                }
            }
            catch (GallerySecurityException)
            {
                return(Forbid());
            }
            catch (Exception ex)
            {
                AppEventController.LogError(ex);

                return(StatusCode(500, _exController.GetExString(ex)));
            }

            return(Ok(galleryItemMeta));
        }
        /// <summary>
        /// Updates the gallery items with the specified metadata value. <see cref="Entity.GalleryItemMeta.ActionResult" />
        /// contains details about the success or failure of the operation.
        /// </summary>
        /// <param name="galleryItemMeta">An instance of <see cref="Entity.GalleryItemMeta" /> that defines
        /// the tag value to be added and the gallery items it is to be added to. It is expected that only
        /// the MTypeId and Value properties of <see cref="Entity.GalleryItemMeta.MetaItem" /> are populated.</param>
        /// <returns>An instance of <see cref="Entity.GalleryItemMeta" />.</returns>
        /// <exception cref="System.Web.Http.HttpResponseException">Thrown when the current user does not have permission
        /// to carry out the operation or an internal server error occurs.</exception>
        public Entity.GalleryItemMeta PutGalleryItemMeta(Entity.GalleryItemMeta galleryItemMeta)
        {
            // /api/galleryitemmeta
            try
            {
                MetadataController.SaveGalleryItemMeta(galleryItemMeta);

                if (galleryItemMeta.ActionResult == null)
                {
                    galleryItemMeta.ActionResult = new ActionResult()
                    {
                        Status = ActionResultStatus.Success.ToString(),
                        Title  = "Save successful"
                    };
                }
            }
            catch (GallerySecurityException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (Exception ex)
            {
                AppEventController.LogError(ex);

                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content      = Utils.GetExStringContent(ex),
                    ReasonPhrase = "Server Error"
                });
            }

            return(galleryItemMeta);
        }
        public async Task <IActionResult> DeleteGalleryItemMeta(Entity.GalleryItemMeta galleryItemMeta)
        {
            // DELETE /api/galleryitemmeta
            try
            {
                var mType = (MetadataItemName)galleryItemMeta.MetaItem.MTypeId;
                if (mType == MetadataItemName.Tags || mType == MetadataItemName.People)
                {
                    await _metadataController.DeleteTag(galleryItemMeta);
                }
                else
                {
                    await _metadataController.Delete(galleryItemMeta);
                }

                return(Ok("Meta item deleted..."));
            }
            catch (GallerySecurityException)
            {
                return(Forbid());
            }
            catch (Exception ex)
            {
                AppEventController.LogError(ex);

                return(StatusCode(500, _exController.GetExString(ex)));
            }
        }
        /// <summary>
        /// Deletes the meta tag value from the specified gallery items.
        /// </summary>
        /// <param name="galleryItemMeta">An instance of <see cref="Entity.GalleryItemMeta" /> that defines
        /// the tag value to be added and the gallery items it is to be added to.</param>
        /// <returns><see cref="HttpResponseMessage" />.</returns>
        /// <exception cref="System.Web.Http.HttpResponseException"></exception>
        public HttpResponseMessage DeleteGalleryItemMeta(Entity.GalleryItemMeta galleryItemMeta)
        {
            // /api/galleryitemmeta
            try
            {
                var mType = (MetadataItemName)galleryItemMeta.MetaItem.MTypeId;
                if (mType == MetadataItemName.Tags || mType == MetadataItemName.People)
                {
                    MetadataController.DeleteTag(galleryItemMeta);
                }
                else
                {
                    MetadataController.Delete(galleryItemMeta);
                }

                return(new HttpResponseMessage(HttpStatusCode.OK)
                {
                    Content = new StringContent("Meta item deleted...")
                });
            }
            catch (GallerySecurityException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (Exception ex)
            {
                AppEventController.LogError(ex);

                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content      = Utils.GetExStringContent(ex),
                    ReasonPhrase = "Server Error"
                });
            }
        }