public static Entities.Model.CustomerComputerInfo.CustomerComputerInfo MapRegisterComputerToCustomerComputerInfo(this RegisterComputer registerComputer,
                                                                                                                         int subscriptionId)
        {
            Entities.Model.CustomerComputerInfo.CustomerComputerInfo customerComputerInfo =
                new Entities.Model.CustomerComputerInfo.CustomerComputerInfo()
            {
                CustomerComputerInfoId                = 0,
                SubscriptionId                        = subscriptionId,
                CustomerComputerInfoHddSerialCode     = registerComputer.ComputerInfoHddSerialCode,
                CustomerComputerInfoMacSerialCode     = registerComputer.ComputerInfoMacSerialCode,
                CustomerComputerInfoProcessSerialCode = registerComputer.ComputerInfoProcessSerialCode,
            };

            return(customerComputerInfo);
        }
        SaveCustomerComputerInfo(Entities.Model.CustomerComputerInfo.CustomerComputerInfo customer)
        {
            OperationResponse <Entities.Model.CustomerComputerInfo.CustomerComputerInfo> response = new OperationResponse <Entities.Model.CustomerComputerInfo.CustomerComputerInfo>();

            try
            {
                if (customer == null)
                {
                    throw new Exception("Customer nesnesi null olamaz");
                }

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

                var subscriptionExists = await _subscriptionManager.GetSubscriptionBySubscriptionId(customer.SubscriptionId);

                if (subscriptionExists.Status == false)
                {
                    throw new Exception(subscriptionExists.Message);
                }

                Entities.Model.CustomerComputerInfo.CustomerComputerInfo customerExists = null;
                if (customer.CustomerComputerInfoId > 0)
                {
                    var existsCustomer = await _unitOfWork.CustomerComputerInfoRepository.GetById(customer.CustomerComputerInfoId);

                    customerExists = existsCustomer ?? throw new Exception("Sistemde kayıtlı bir müşteri bilgisi bulunamadı.");
                }
                else
                {
                    var existsCustomer =
                        await _unitOfWork.CustomerComputerInfoRepository.GetByCustomerComputerHddAndMacAndProcessSerialCode(
                            customer.CustomerComputerInfoHddSerialCode, customer.CustomerComputerInfoMacSerialCode,
                            customer.CustomerComputerInfoProcessSerialCode);

                    if (existsCustomer != null)
                    {
                        throw new Exception("HDD, Mac ve Serial bilgisine göre zaten bir kayıt mevcut. Var olan kayıt üzerinden devam ediniz.");
                    }
                }

                if (customerExists != null)
                {
                    customerExists.SubscriptionId = customerExists.SubscriptionId;
                    customerExists.CustomerComputerInfoHddSerialCode     = customerExists.CustomerComputerInfoHddSerialCode;
                    customerExists.CustomerComputerInfoMacSerialCode     = customerExists.CustomerComputerInfoMacSerialCode;
                    customerExists.CustomerComputerInfoProcessSerialCode = customerExists.CustomerComputerInfoProcessSerialCode;
                    customerExists.UpdatedDateTime = DateTime.Now;
                    await _unitOfWork.CustomerComputerInfoRepository.Update(customerExists);
                }
                else
                {
                    customer.CreatedDateTime = DateTime.Now;
                    await _unitOfWork.CustomerComputerInfoRepository.Insert(customer);
                }

                response.Data = customer;
                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);
        }