/**
  * Insert or update application files
  * Certain array structure need to be passed
  * 
  * array(
  * 	0 => array(
  * 		'id' 	=> If numeric and larger than 0, file will be updated. Otherwise file is considered new
  * 		'data'	=> Array of file data to insert
  * 	),
  * 	1 => array(
  * 		'id' 	=> If numeric and larger than 0, file will be updated. Otherwise file is considered new
  * 		'data'	=> Array of file data to insert
  * 	),
  * 	etc.
  * )
  * 
  * @param $files
  */
 public static function bind_files($files = array())
 {
     if (empty($files) || !is_array($files)) {
         return false;
     }
     foreach ($files as $key => $file) {
         $data = $file['data'];
         if (is_numeric($file['id']) && $file['id'] > 0) {
             // Update existing file
             $item = Model_File::find_one_by_id($file['id']);
             $item->set($data);
         } else {
             $item = Model_File::forge($data);
         }
         $item->save();
     }
 }