public async Task <SetClientResponse> SetClientAsync(SetClientParam param, CancellationToken cancellationToken)
        {
            var retVal = await GetClientAsync(param, cancellationToken);

            SetProperties(retVal.Client, param);
            SetClientSecret(retVal, param);

            retVal.Client.AllowedScopes = retVal.Client.AllowedScopes.UnionWithTokens(param.ScopesToAdd);
            retVal.Client.AllowedScopes = retVal.Client.AllowedScopes.RemoveTokens(param.ScopesToRemove);

            retVal.Client.AllowedGrantTypes = retVal.Client.AllowedGrantTypes.UnionWithTokens(param.GrantTypesToAdd);
            retVal.Client.AllowedGrantTypes = retVal.Client.AllowedGrantTypes.RemoveTokens(param.GrantTypesToRemove);
            if (retVal.Client.AllowedGrantTypes.Count == 0)
            {
                throw new NoAllowedGrantsGivenException();
            }

            if (!param.DryRun)
            {
                await _repository.SetClientAsync(retVal.Client, param, cancellationToken);
            }

            retVal.DryRun = param.DryRun;
            return(retVal);
        }