public JsonResult DeleteProductPicture(int productId, int pictureId)
        {
            try
            {
                // Get the offer
                var product = metadataServiceClient.GetProducts(new ProductQuery()
                {
                    ProductIds = new List <int> {
                        productId
                    },
                    Envelope = "full"
                }).Result.FirstOrDefault();

                if (User.IsInRole("Administrator"))
                {
                    // Get the removal picture
                    var picture = product.Pictures.Where(p => p.PictureId == pictureId).FirstOrDefault();

                    // Delete the picture from metadata
                    var response = metadataServiceClient.DeleteProductPicture(new ProductPictureCommand()
                    {
                        Environment   = this.Environment,
                        UserToken     = this.UserToken,
                        SessionId     = this.SessionId,
                        PictureId     = pictureId,
                        ApplicationIP = HttpContext.Request.UserHostAddress,
                        ProductId     = productId
                    });

                    // Check the response
                    if (response.Type != Headstone.MetaData.Common.Models.ServiceResponseTypes.Success)
                    {
                        Log(Headstone.Framework.Models.LogMode.Error, $"There is an error while deleting the product picture! Error:{response.Message}", null);

                        return(Json(new headstoneControllerResponse()
                        {
                            ReturnCode = -300
                        }, JsonRequestBehavior.AllowGet));
                    }

                    // Get the product pictures
                    var newProductpictures = metadataServiceClient.GetProductPictures(new ProductPictureQuery()
                    {
                        ProductIds = new List <int> {
                            Convert.ToInt32(productId)
                        },
                        Envelope = "full"
                    }).Result.ToList();

                    var picturemodel = newProductpictures.Select(s => new ProductPicture()
                    {
                        Alt       = s.Alt,
                        PictureId = s.PictureId,
                        ProductId = s.ProductId,
                        ImageUrl  = s.ImageUrl
                    }).ToList();

                    // Create the model
                    var model = new ProductPictureListViewModel()
                    {
                        PictureKey = CreateThreadId(5),
                        ProductId  = Convert.ToInt32(productId),
                        Pictures   = picturemodel
                    };

                    // Convert partial to string
                    var partial = ViewToString("Products", "~/Views/Products/Pictures.cshtml", model);

                    return(Json(new headstonePartialResponse()
                    {
                        ReturnCode = 200,
                        Html = partial
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    Log(Headstone.Framework.Models.LogMode.Error, $"Authorize failure", null);

                    return(Json(new headstoneControllerResponse()
                    {
                        ReturnCode = -300
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                Log(Headstone.Framework.Models.LogMode.Error, $"There is an error while deleting the offer picture!", ex);

                return(Json(new headstoneControllerResponse()
                {
                    ReturnCode = -300
                }, JsonRequestBehavior.AllowGet));
            }
        }