public void MakeItSoTeam(ApplicationProfile app) { _logger.LogInformation($"Checking to see if team {app.application_name} already exists."); if (!_veracodeService.DoesTeamExistForApp(app)) { _logger.LogInformation($"Team {app.application_name} does not exist, adding configuration."); try { _veracodeService.CreateTeamForApp(app); _logger.LogInformation($"Team {app.application_name} created succesfully."); } catch (Exception e) { _logger.LogError($"Team {app.application_name} could not be created!"); _logger.LogError($"{e.Message}."); } return; } _logger.LogInformation($"Team {app.application_name} exists."); var usersInTeam = _veracodeService.GetUserEmailsOnTeam(app); foreach (var user in usersInTeam) { _logger.LogInformation($"Checking if {user.email_address} is assigned to team {app.application_name}."); if (!_veracodeService.IsUserAssignedToTeam(user, app)) { _logger.LogInformation($"User {user.email_address} is not assigned to team {app.application_name}, updating configuration."); try { if (string.IsNullOrEmpty(user.teams)) { user.teams = $"{app.application_name}"; } else { user.teams = $",{app.application_name}"; } _veracodeService.UpdateUser(user); _logger.LogInformation($"User {user.email_address} assigned to team {app.application_name} succesfully."); } catch (Exception e) { _logger.LogError($"User {user.email_address} could not be added to team {app.application_name}!"); _logger.LogError($"{e.Message}."); } } else { _logger.LogInformation($"User {user.email_address} is already assigned to team {app.application_name}."); } } }