public void SaveLicenseMessage(AppLicenseMessageDTO model) { var prl = _dataService.GetEntity <PrlApplication>(p => p.Id == model.AppId).SingleOrDefault(); if (prl == null || string.IsNullOrEmpty(prl.ExpertiseResult) || prl.AppDecisionId == null) { return; } var licenseMsg = _dataService.GetEntity <AppLicenseMessage>(p => p.Id == model.Id).SingleOrDefault(); if (licenseMsg != null) { return; } licenseMsg = new AppLicenseMessage(); _objectMapper.Map(model, licenseMsg); licenseMsg.Performer = model.PerformerId; licenseMsg.OldLimsId = _limsExchangeService.ExportLimsMessage(licenseMsg).Result; licenseMsg.State = "Підготовка"; _dataService.Add(licenseMsg); _dataService.SaveChanges(); }