public function execute(CommandContext $context)
 {
     // Check permissions
     if (!Current_User::allow('hms', 'damage_assessment')) {
         throw new PermissionException('You do not have permission to perform room damage assessment.');
     }
     $data = $_POST['responsibilities'];
     // For each responsibility object submitted
     foreach ($data as $row) {
         // Load it from the database
         $resp = RoomDamageResponsibilityFactory::getResponsibilityById($row['id']);
         $resp->setAmount(round($row['assessedCost']));
         $resp->setState('assessed');
         $resp->setAssessedOn(time());
         $resp->setAssessedBy(UserStatus::getUsername());
         RoomDamageResponsibilityFactory::save($resp);
     }
     header('HTTP/1.1 200 Ok');
 }
 private function addDamage(array $dmg, HMS_Room $room)
 {
     $damage = new RoomDamage($room, $this->term, $dmg['damage_type'], $dmg['side'], $dmg['note']);
     // Save the damage
     RoomDamageFactory::save($damage);
     // Determine the residents which were responsible
     // For each resident submitted
     foreach ($dmg['residents'] as $resident) {
         // If the resident was selected as being responsible for this damage
         if (isset($resident['selected']) && $resident['selected']) {
             // Create the student
             $student = StudentFactory::getStudentByBannerId($resident['studentId'], $this->term);
             // Create the responsibility
             $resp = new RoomDamageResponsibility($student, $damage);
             RoomDamageResponsibilityFactory::save($resp);
         }
     }
 }