public Service ChangePlan([FromBody] PaymentBinding temp)
        {
            Service service = db.Services.Where(a => a.id.Equals(temp.ServiceId)).Include("Creator")
                              .FirstOrDefault();

            if (temp.Amount.Equals("") || temp.Amount == null)
            {
                core.throwExcetpion("Amount can't be null");
            }

            service.ServicePathId = temp.ServicePathId;
            if (!temp.UseUserPoints)
            {
                AddPayment(temp, service);
            }
            else
            {
                SystemParameter param = db.SystemParameters.Where(x => x.Code.Equals("ServicePricePerPoints")).AsNoTracking().FirstOrDefault();
                int             ServicePricePerPoints = Int32.Parse(param.Value);

                if (service.Creator.PointsBalance - ServicePricePerPoints > 0)
                {
                    service.Creator.PointsBalance = service.Creator.PointsBalance - ServicePricePerPoints;
                    //db.Entry(user).State = EntityState.Modified;
                    // db.SaveChanges();
                }
                else
                {
                    core.throwExcetpion("No Remaining Points!");
                }
            }

            SaveService(service);
            return(service);
        }
        private void AddPayment(PaymentBinding temp, Service service)
        {
            Payment payment = new Payment();

            payment.Method    = temp.Method;
            payment.ServiceId = temp.ServiceId;
            payment.Status    = "Done";
            payment.Currency  = temp.Currency;
            payment.Amount    = temp.Amount;
            //payment.ServiceProviderId = service.ServiceProviderId;
            payment.CreatorId            = core.getCurrentUser().Id;
            payment.ModifierId           = core.getCurrentUser().Id;
            payment.CreationDate         = DateTime.Now;
            payment.LastModificationDate = DateTime.Now;
            db.Payments.Add(payment);
        }