private bool HasOwnerWithInvalidUsername(IValidationRequest request)
        {
            var registration = _packages.FindPackageRegistrationById(request.PackageId);

            if (registration == null)
            {
                _logger.LogError("Attempted to validate package that has no package registration");

                throw new InvalidOperationException($"Registration for package id {request.PackageId} does not exist");
            }

            var owners = registration.Owners.Select(o => o.Username).ToList();

            if (owners.Any(UsernameHelper.IsInvalid))
            {
                _logger.LogWarning(
                    "Package {PackageId} {PackageVersion} has an owner with an invalid username. {Owners}",
                    request.PackageId,
                    request.PackageVersion,
                    owners);

                return(true);
            }

            return(false);
        }
        private List <string> FindPackageOwners(INuGetValidationRequest request)
        {
            var registration = _packageService.FindPackageRegistrationById(request.PackageId);

            if (registration == null)
            {
                _logger.LogError("Attempted to validate package that has no package registration");

                throw new InvalidOperationException($"Registration for package id {request.PackageId} does not exist");
            }

            return(registration
                   .Owners
                   .Select(o => o.Username)
                   .ToList()
                   .OrderBy(u => u, StringComparer.InvariantCultureIgnoreCase)
                   .ToList());
        }