Remove user sessions from a client

I want to remove all the users sessions only for the specify client in Keycloak but I am not finding a way. What I did until now is as below:

List<UserSessionModel> userSessions = session.sessions()
                                             .getUserSessionsStream(realm,client)
                                             .collect(Collectors.toList())
for (UserSessionModel userSession : userSessions) {
    AuthenticatedClientSessionModel clientSession = userSession.getAuthenticatedClientSessionByClient(client.getId());
    userSession.removeAuthenticatedClientSessions(Collections.singleton(client.getId()));

}

How can I fix this?

I am trying to find a solution for this.