public int CompareProduct(int variantId, int UserId, string IpAddress)
        {
            var message  = 0;
            var counting = new List <CompareProduct>();

            try
            {
                if (variantId > 0)

                {
                    var obj = db.CompareProducts.Where(x => x.ProductVariantDetailId == variantId && x.IsActive == true && (x.UserId == UserId || x.IpAddress == IpAddress)).ToList();
                    if (obj.Count == 0)
                    {
                        var SaveProduct = new CompareProduct();
                        SaveProduct.ProductVariantDetailId = variantId;
                        SaveProduct.IsActive = true;
                        if (IpAddress != null)
                        {
                            SaveProduct.IpAddress = IpAddress;
                        }
                        if (UserId > 0)
                        {
                            SaveProduct.UserId = UserId;
                        }
                        db.Add(SaveProduct);
                        db.SaveChanges();
                        var actionResult   = CompareProducts(UserId, IpAddress);
                        var okObjectResult = actionResult as OkObjectResult;

                        var model = okObjectResult.Value as  List <product1>;

                        message = model.Count;
                    }
                    //  counting = db.CompareProducts.Where(x => x.IsActive == true && (x.UserId == UserId || x.IpAddress == IpAddress)).ToList();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(message);
        }