private async Task AddClients()
    {
        var client = new Client(_testData.Client1Id, "ClientId1")
        {
            Description           = nameof(Client.Description),
            ClientName            = nameof(Client.ClientName),
            ClientUri             = nameof(Client.ClientUri),
            LogoUri               = nameof(Client.LogoUri),
            ProtocolType          = nameof(Client.ProtocolType),
            FrontChannelLogoutUri = nameof(Client.FrontChannelLogoutUri)
        };

        client.AddCorsOrigin("https://client1-origin.com");
        client.AddCorsOrigin("https://{0}.abp.io");
        client.AddClaim(nameof(ClientClaim.Type), nameof(ClientClaim.Value));
        client.AddGrantType(nameof(ClientGrantType.GrantType));
        client.AddIdentityProviderRestriction(nameof(ClientIdPRestriction.Provider));
        client.AddPostLogoutRedirectUri(nameof(ClientPostLogoutRedirectUri.PostLogoutRedirectUri));
        client.AddProperty(nameof(ClientProperty.Key), nameof(ClientProperty.Value));
        client.AddRedirectUri(nameof(ClientRedirectUri.RedirectUri));
        client.AddScope(nameof(ClientScope.Scope));
        client.AddSecret(nameof(ClientSecret.Value));

        await _clientRepository.InsertAsync(client);

        await _clientRepository.InsertAsync(new Client(_guidGenerator.Create(), "ClientId2"));

        await _clientRepository.InsertAsync(new Client(_guidGenerator.Create(), "ClientId3"));


        var client42 = new Client(_guidGenerator.Create(), "42")
        {
            ProtocolType = "TestProtocol-42"
        };

        client42.AddCorsOrigin("Origin1");
        client42.AddScope("Test-ApiScope-Name-1");
        await _clientRepository.InsertAsync(client42);
    }
        public virtual async Task <ClientDto> CloneAsync(ClientCloneInputDto clientCloneInput)
        {
            var clientIdExists = await ClientRepository.CheckClientIdExistAsync(clientCloneInput.ClientId);

            if (clientIdExists)
            {
                throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.ClientIdExisted, clientCloneInput.ClientId]);
            }
            var srcClient = await ClientRepository.GetAsync(clientCloneInput.SourceClientId);

            var client = new Client(GuidGenerator.Create(), clientCloneInput.ClientId);

            client.ClientName  = clientCloneInput.ClientName;
            client.Description = clientCloneInput.Description;
            client.AbsoluteRefreshTokenLifetime = srcClient.AbsoluteRefreshTokenLifetime;
            client.AccessTokenLifetime          = srcClient.AccessTokenLifetime;
            client.AccessTokenType                  = srcClient.AccessTokenType;
            client.AllowAccessTokensViaBrowser      = srcClient.AllowAccessTokensViaBrowser;
            client.AllowOfflineAccess               = srcClient.AllowOfflineAccess;
            client.AllowPlainTextPkce               = srcClient.AllowPlainTextPkce;
            client.AllowRememberConsent             = srcClient.AllowRememberConsent;
            client.AlwaysIncludeUserClaimsInIdToken = srcClient.AlwaysIncludeUserClaimsInIdToken;
            client.AlwaysSendClientClaims           = srcClient.AlwaysSendClientClaims;
            client.AuthorizationCodeLifetime        = srcClient.AuthorizationCodeLifetime;
            client.BackChannelLogoutSessionRequired = srcClient.BackChannelLogoutSessionRequired;

            client.BackChannelLogoutUri = srcClient.BackChannelLogoutUri;
            client.ClientClaimsPrefix   = srcClient.ClientClaimsPrefix;
            client.ConsentLifetime      = srcClient.ConsentLifetime;
            client.DeviceCodeLifetime   = srcClient.DeviceCodeLifetime;
            client.Enabled          = srcClient.Enabled;
            client.EnableLocalLogin = srcClient.EnableLocalLogin;
            client.FrontChannelLogoutSessionRequired = srcClient.FrontChannelLogoutSessionRequired;
            client.FrontChannelLogoutUri             = srcClient.FrontChannelLogoutUri;

            client.IdentityTokenLifetime = srcClient.IdentityTokenLifetime;
            client.IncludeJwtId          = srcClient.IncludeJwtId;
            client.LogoUri                = srcClient.LogoUri;
            client.PairWiseSubjectSalt    = srcClient.PairWiseSubjectSalt;
            client.ProtocolType           = srcClient.ProtocolType;
            client.RefreshTokenExpiration = srcClient.RefreshTokenExpiration;
            client.RefreshTokenUsage      = srcClient.RefreshTokenUsage;
            client.RequireClientSecret    = srcClient.RequireClientSecret;
            client.RequireConsent         = srcClient.RequireConsent;

            client.RequirePkce = srcClient.RequirePkce;
            client.SlidingRefreshTokenLifetime      = srcClient.SlidingRefreshTokenLifetime;
            client.UpdateAccessTokenClaimsOnRefresh = srcClient.UpdateAccessTokenClaimsOnRefresh;

            client.UserCodeType    = srcClient.UserCodeType;
            client.UserSsoLifetime = srcClient.UserSsoLifetime;

            if (clientCloneInput.CopyAllowedCorsOrigin)
            {
                foreach (var corsOrigin in srcClient.AllowedCorsOrigins)
                {
                    client.AddCorsOrigin(corsOrigin.Origin);
                }
            }
            if (clientCloneInput.CopyAllowedGrantType)
            {
                foreach (var grantType in srcClient.AllowedGrantTypes)
                {
                    client.AddGrantType(grantType.GrantType);
                }
            }
            if (clientCloneInput.CopyAllowedScope)
            {
                foreach (var scope in srcClient.AllowedScopes)
                {
                    client.AddScope(scope.Scope);
                }
            }
            if (clientCloneInput.CopyClaim)
            {
                foreach (var claim in srcClient.Claims)
                {
                    client.AddClaim(claim.Value, claim.Type);
                }
            }
            if (clientCloneInput.CopyIdentityProviderRestriction)
            {
                foreach (var provider in srcClient.IdentityProviderRestrictions)
                {
                    client.AddIdentityProviderRestriction(provider.Provider);
                }
            }
            if (clientCloneInput.CopyPostLogoutRedirectUri)
            {
                foreach (var uri in srcClient.PostLogoutRedirectUris)
                {
                    client.AddPostLogoutRedirectUri(uri.PostLogoutRedirectUri);
                }
            }
            if (clientCloneInput.CopyPropertie)
            {
                foreach (var property in srcClient.Properties)
                {
                    client.AddProperty(property.Key, property.Value);
                }
            }
            if (clientCloneInput.CopyRedirectUri)
            {
                foreach (var uri in srcClient.RedirectUris)
                {
                    client.AddRedirectUri(uri.RedirectUri);
                }
            }
            client = await ClientRepository.InsertAsync(client);

            return(ObjectMapper.Map <Client, ClientDto>(client));
        }