public async Task <OperationResponse <List <SubscriptionInfo> > > GetSubscriptionSummaryListByCustomerId(int customerId)
        {
            OperationResponse <List <SubscriptionInfo> > response = new OperationResponse <List <SubscriptionInfo> >();

            try
            {
                var subscriptionList = await _unitOfWork.SubscriptionRepository.GetSubscriptionListByCustomerId(customerId);

                var softwareList = await _softwareManager.GetSoftwareList();

                List <SubscriptionInfo> list = new List <SubscriptionInfo>();
                foreach (var t in subscriptionList)
                {
                    Entities.Model.Software.Software soft = null;
                    if (softwareList.Status)
                    {
                        soft = softwareList.Data.FirstOrDefault(x => x.SoftwareId == t.SoftwareId);
                    }

                    var r = await _customerComputerInfoManager.GetAlreadyComputerCountsBySubscriptionId(t.SubscriptionId);

                    int alreadyCount = r.Status ? r.Data : 0;
                    var subscription = new SubscriptionInfo()
                    {
                        SoftwareId                      = t.SoftwareId,
                        CustomerId                      = t.CustomerId,
                        SubscriptionId                  = t.SubscriptionId,
                        SubScriptionEndDate             = t.SubScriptionEndDate,
                        SubScriptionStartDate           = t.SubScriptionStartDate,
                        SubscriptionIsActive            = t.SubscriptionIsActive,
                        SubScriptionLicenceCount        = t.SubScriptionLicenceCount,
                        SoftwareName                    = soft != null ? soft.SoftwareName : "",
                        SubScriptionCurrentLicenceCount = alreadyCount,
                    };

                    list.Add(subscription);
                }
                response.Data   = list;
                response.Status = true;
            }
            catch (Exception e)
            {
                response.Status  = false;
                response.Message = e.Message;
            }
            return(response);
        }
        public async Task <OperationResponse <Entities.Model.Software.Software> > SaveSoftware(
            Entities.Model.Software.Software software)
        {
            OperationResponse <Entities.Model.Software.Software> response = new OperationResponse <Entities.Model.Software.Software>();

            try
            {
                if (software == null)
                {
                    throw new Exception("Software nesnesi null olamaz");
                }

                var valid = await new SoftwareValidator().ValidateAsync(software);
                if (valid.IsValid == false)
                {
                    throw new Exception(valid.GetErrorMessagesOnSingleLine());
                }

                Entities.Model.Software.Software softwareExists = null;
                if (software.SoftwareId > 0)
                {
                    var existsSoftware = await _unitOfWork.SoftwareRepository.GetById(software.SoftwareId);

                    softwareExists = existsSoftware ?? throw new Exception("Sistemde kayıtlı bir yazılım bilgisi bulunamadı.");
                }
                else
                {
                    //Check software by name
                    //İf exists good bye..
                    var existsSoftware = await _unitOfWork.SoftwareRepository.GetSoftwareByName(software.SoftwareName);

                    if (existsSoftware != null)
                    {
                        throw new Exception("Sistemde zaten bu isimde ile kayıtlı bir yazılım bilgisi var.");
                    }
                }


                if (softwareExists != null)
                {
                    softwareExists.SoftwareIsActive    = software.SoftwareIsActive;
                    softwareExists.SoftwareLastVersion = software.SoftwareLastVersion;
                    softwareExists.SoftwareName        = software.SoftwareName;
                    softwareExists.UpdatedDateTime     = DateTime.Now;

                    await _unitOfWork.SoftwareRepository.Update(softwareExists);
                }
                else
                {
                    software.CreatedDateTime = DateTime.Now;
                    await _unitOfWork.SoftwareRepository.Insert(software);
                }

                response.Data = software;
                var responseUnitOfWork = await _unitOfWork.Save();

                response.Status  = responseUnitOfWork.Status;
                response.Message = responseUnitOfWork.Message;
            }
            catch (Exception e)
            {
                response.Status  = false;
                response.Message = e.Message;
            }

            return(response);
        }