public void SaveAgreement(Agreement newAgreement) { SetTempOrderAgreemenr(newAgreement); _agreementRepository.Add(newAgreement); if (tempOrderAgreement != null) { tempOrderAgreement.AgreementId = newAgreement.Id; if (_orderAgreementRepository.GetAllByExpression().Where(ordAgr => ordAgr.OrderId == tempOrderAgreement.OrderId).ToList() == null) { _orderAgreementRepository.Add(tempOrderAgreement); } } }