public void Create(FullUser fullUser) { if ( fullUser.IsValid() && fullUser.Worker.IsValid(_workerServices.Read().Select(x => x.PassportNumber).ToList()) && (fullUser?.User?.IsValid(_userServices.Read().Select(y => y.Login).ToList()) ?? true) ) { try { _workerServices.Create(fullUser.Worker); } catch (Exception) { throw; } if (fullUser.User != null) { fullUser.User = _userServices.Create(fullUser.User); foreach (var item in fullUser.Roles) { _userRoleServices.Create(new UserRole() { UserId = fullUser.User.Id, RoleId = item.Id }); } } } }