Don’t put the DB fields in a scenario, only the one’s you want to validate off the form, then validate against the scenario and save the DB fields with no validation (since you need to validate and save separately now) or switch scenarios.
you are not saving the models to the DB, you need to call [font="Courier New"]$modelUserDepartment->save()[/font] at the end of the loop.
As far as I understand from your code, the form only contains the input fields for the 3 [font="Courier New"]department_id_x[/font] properties. In this case there is no need to add these non-model properties to the [font="Courier New"]UserDepartment[/font] model, instead I would create a [font="Courier New"]UserDepartmentForm[/font] model as a subclass of [font="Courier New"]CFormModel[/font] which only contains these 3 properties, and use it for handling the form. Then you can remove those fields from the [font="Courier New"]UserDepartment[/font] model.