public static function setObjectStatusAction(DatabaseObject &$object, $action) { if ($action == 'publish') { $object->sendLive(); $object->save(); } else { if ($action == 'unpublish') { $object->sendBackToDraft(); //echo "object sent back to draft"; $object->save(); } else { if ($action == 'delete') { $object->delete(); } } } }