public virtual async Task <ClientDto> CloneAsync(Guid id, ClientCloneDto input)
 {
     return(await ClientAppService.CloneAsync(id, input));
 }
        public virtual async Task <ClientDto> CloneAsync(Guid id, ClientCloneDto input)
        {
            var clientIdExists = await ClientRepository.CheckClientIdExistAsync(input.ClientId);

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

            var client = new Client(GuidGenerator.Create(), input.ClientId)
            {
                ClientName  = input.ClientName,
                Description = input.Description,
                AbsoluteRefreshTokenLifetime = srcClient.AbsoluteRefreshTokenLifetime,
                AccessTokenLifetime          = srcClient.AccessTokenLifetime,
                AccessTokenType                  = srcClient.AccessTokenType,
                AllowAccessTokensViaBrowser      = srcClient.AllowAccessTokensViaBrowser,
                AllowOfflineAccess               = srcClient.AllowOfflineAccess,
                AllowPlainTextPkce               = srcClient.AllowPlainTextPkce,
                AllowRememberConsent             = srcClient.AllowRememberConsent,
                AlwaysIncludeUserClaimsInIdToken = srcClient.AlwaysIncludeUserClaimsInIdToken,
                AlwaysSendClientClaims           = srcClient.AlwaysSendClientClaims,
                AuthorizationCodeLifetime        = srcClient.AuthorizationCodeLifetime,
                BackChannelLogoutSessionRequired = srcClient.BackChannelLogoutSessionRequired,

                BackChannelLogoutUri = srcClient.BackChannelLogoutUri,
                ClientClaimsPrefix   = srcClient.ClientClaimsPrefix,
                ConsentLifetime      = srcClient.ConsentLifetime,
                DeviceCodeLifetime   = srcClient.DeviceCodeLifetime,
                Enabled          = srcClient.Enabled,
                EnableLocalLogin = srcClient.EnableLocalLogin,
                FrontChannelLogoutSessionRequired = srcClient.FrontChannelLogoutSessionRequired,
                FrontChannelLogoutUri             = srcClient.FrontChannelLogoutUri,

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

                RequirePkce = srcClient.RequirePkce,
                SlidingRefreshTokenLifetime      = srcClient.SlidingRefreshTokenLifetime,
                UpdateAccessTokenClaimsOnRefresh = srcClient.UpdateAccessTokenClaimsOnRefresh,

                UserCodeType    = srcClient.UserCodeType,
                UserSsoLifetime = srcClient.UserSsoLifetime
            };

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

            await CurrentUnitOfWork.SaveChangesAsync();

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