public async Task <IdentityServerStoreAppliedInfo> UpsertClientIdIntoUsersAsync(IdentityServerUserClientId userClientId,
                                                                                        CancellationToken cancellationToken = default(CancellationToken))
        {
            var userExists = await FindDoesUserExistByUserIdAsync(userClientId.UserId, cancellationToken);

            if (!userExists)
            {
                // not allowed
                return(new IdentityServerStoreAppliedInfo
                {
                    Applied = false,
                    Exception = new UserDoesNotExitException()
                });
            }

            var     session = CassandraSession;
            IMapper mapper  = new Mapper(session);

            cancellationToken.ThrowIfCancellationRequested();
            var record = await
                         mapper.InsertIfNotExistsAsync(userClientId);

            return(new IdentityServerStoreAppliedInfo(record.Applied));
        }
        public async Task <IdentityServerStoreAppliedInfo> DeleteClientIdFromUserAsync(IdentityServerUserClientId userClientId,
                                                                                       CancellationToken cancellationToken = default(CancellationToken))
        {
            var userExists = await FindDoesUserExistByUserIdAsync(userClientId.UserId, cancellationToken);

            if (!userExists)
            {
                // not allowed
                return(new IdentityServerStoreAppliedInfo
                {
                    Applied = false,
                    Exception = new UserDoesNotExitException()
                });
            }
            var     session = CassandraSession;
            IMapper mapper  = new Mapper(session);

            cancellationToken.ThrowIfCancellationRequested();
            var record = await
                         mapper.DeleteIfAsync <IdentityServerUserClientId>(
                "WHERE clientid = ? AND userid = ?", userClientId.ClientId, userClientId.UserId);

            return(new IdentityServerStoreAppliedInfo(record.Applied));
        }