public void SaveLicenseMessage(AppLicenseMessageDTO model) { var iml = _dataService.GetEntity <ImlApplication>(p => p.Id == model.AppId).SingleOrDefault(); if (iml == null || string.IsNullOrEmpty(iml.ExpertiseResult) || iml.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.ExportLimsMessageIML(licenseMsg).Result; licenseMsg.State = "Підготовка"; _dataService.Add(licenseMsg); _dataService.SaveChanges(); }