Handling the casting of ReservedUnitType in encoding in SDK