We shouldn't have a mix of procedural and object oriented programing.  $program should be a first class object and should know how to get its assets, e.g.:

  $assets = $program->assets;