/**
  * @param ActivityPublished $file
  * @return bool|null
  */
 public function updatePublishedStatus($file)
 {
     $file->published_to_register = 0;
     if (!$file->save()) {
         return null;
     }
     return true;
 }
 public function unsetPublishedFlag($changes)
 {
     foreach ($changes['previous'] as $filename => $previous) {
         $filePath = public_path('files/xml/') . $filename;
         if ($this->activityPublished->where('filename', '=', $filename)->delete()) {
             if (file_exists($filePath)) {
                 unlink($filePath);
             }
         }
     }
 }
 /** Returns no. of activities published in the registry.
  * @param $orgId
  * @return mixed
  */
 public function getNoOfActivitiesPublished($orgId)
 {
     return $this->activityPublished->getNoOfActivitiesPublished($orgId);
 }
 /**
  * Gets the records for the currently published activities from the Aidstream database.
  * @return \Illuminate\Database\Eloquent\Collection|static[]
  */
 protected function getCurrentlyPublishedActivities()
 {
     return $this->activityPublished->query()->where('organization_id', '=', $this->organization->id)->get();
 }