DbSession dbSession = dbClient.openSession(false);
try {
WsTemplateRef templateRef = WsTemplateRef.fromRequest(wsRequest);
PermissionTemplateDto template = dependenciesFinder.getTemplate(dbSession, templateRef);
PermissionQuery query = buildQuery(wsRequest, template);
<BUG>WsUsersResponse templateUsersResponse = buildResponse(dbSession, query, template);
</BUG>
writeProtobuf(templateUsersResponse, wsRequest, wsResponse);
} finally {
dbClient.closeSession(dbSession);

DbSession dbSession = dbClient.openSession(false);
try {
WsTemplateRef templateRef = WsTemplateRef.fromRequest(wsRequest);
PermissionTemplateDto template = dependenciesFinder.getTemplate(dbSession, templateRef);
PermissionQuery query = buildQuery(wsRequest, template);
WsPermissions.UsersWsResponse templateUsersResponse = buildResponse(dbSession, query, template);
writeProtobuf(templateUsersResponse, wsRequest, wsResponse);
} finally {
dbClient.closeSession(dbSession);
