BTW, I think you should add a constraint which should not allow the course page to be saved is there's an empty unit in it i.e.: an unity where the user selected nothing.
Well that is very rare case that an empty unit got saved ,infact its the first time . Maybe there was a unit before and it was deleted after .