public void CreateSubscription()
        {
            User             adminUser = userLogic.GetUserByEmail("*****@*****.**");
            UserSubscription sub       = new UserSubscription();

            sub.Quantity         = 2;
            sub.SubscriptionDate = DateTime.Now;
            sub.SubscriptionId   = 1;
            sub.UserId           = adminUser.UserId;
            useSubLogic.CreateSubscription(sub);
        }
        public void UpdateUserSubscription(List <UserSubscriptionData> userSubscriptionData)
        {
            List <SubscriptionType> typeList = new List <SubscriptionType>();

            foreach (var data in userSubscriptionData)
            {
                var tempObj = data.Subscription.SubscriptionType;
                tempObj.ProductIdList = tempObj.Products.Select(p => (dynamic) new { Id = p.Id, ProductCode = p.ProductCode }).ToList();
                typeList.Add(tempObj);

                UserSubscription sub = new UserSubscription();
                sub.Quantity         = data.Quantity;
                sub.SubscriptionDate = data.SubscriptionDate;
                sub.RenewalDate      = data.RenewalDate;
                sub.SubscriptionId   = data.SubscriptionId;
                sub.UserId           = data.UserId;
                var userSubscriptionId = userSubLogic.CreateSubscription(sub);

                List <License.DataModel.LicenseData> licenseDataList = new List <DataModel.LicenseData>();
                foreach (var lic in data.LicenseKeys)
                {
                    License.DataModel.LicenseData licenseData = new DataModel.LicenseData()
                    {
                        LicenseKey         = lic.LicenseKey,
                        ProductId          = lic.ProductId,
                        UserSubscriptionId = userSubscriptionId
                    };
                    licenseDataList.Add(licenseData);
                }
                LicenseLogic licenseLogic = new LicenseLogic();
                licenseLogic.CreateLicenseData(licenseDataList);
            }

            try
            {
                if (typeList.Count > 0)
                {
                    Logic.BusinessLogic.SubscriptionBO proSubLogic = new Logic.BusinessLogic.SubscriptionBO();
                    proSubLogic.SaveToFile(typeList);
                }
            }
            catch (Exception ex)
            {
                Logger.Logger.Error(ex);
            }
        }