The following is an example of the current situation.
val client = ctx.getReference<ClientState>()
require(client.id == Identifier(msg.clientId)){"mismatch client"}
This is a boring and error-prone code.
The process of getting a state followed by checking the identifier of it should be combined into a single method.