Having tested return
which works as it should this suggests I have something wrong in
MFCategoryID = $MFoptions.ID
and I am wondering if it is $MFoptions.ID but I can't see what.
Well, actually you can't use $MFoptions.ID, it's not valid PHP Code. In PHP, accessing members of an Object always requires the -> operator (except static members of course).
What might have confused you is the syntax used in SilverStripe Templates. There you access members of an Object using the dot (.).