In this case, how should you call a function with the 'no_rollback' effect?

I am trying to send agent information to a class selector and launch it. I wrote the code below, but I get the error ‘This invocation calls a function that has the ‘no_rollback’ effect, which is not allowed by its context.’ In this case, how should I call the function?

 AllotClass(Agent : agent) : void =
         if:
             Player := player[Agent]
             Pdt:player_data_table = PlayerDataMap[Player]
             Tp :=Pdt.Tps
             Rpt := Round[Tp]
             CrtCls := Pdt.CrntClass

             if(Rpt > CLS1STD):                                
                 if(Rpt > CLS2STD)
                 then:
                    # Other Processing
                 else:
                     if(CrtCls = 2)
                     then:
             
                         ClassSelector.ChangeClass(Player) # <-- Call here

                    else:
                       # Other Processing 

This is my own response, but I solved it by using a case expression as shown below. Sorry for the trouble :laughing:.

case(CrtCls):
   	"0" => 
        # Other Processing

    "2" => 
        ClassSelector.ChangeClass(Player)

	_ =>
		# Other Processing