code: protected function saveAssignments()
      {
          $assignmentData = [];
          foreach ($this->assignments as $userId => $assignments) {
              foreach ($assignments as $name => $assignment) {
                  /* @var $assignment Assignment */
                  $assignmentData[$userId][] = $assignment->roleName;
              }
          }
          $this->saveToFile($assignmentData, $this->assignmentFile);
      }
docs: Saves assignments data into persistent storage.