public static function getAllPersistedAttributes() {
    $calledClass = get_called_class();

    if (array_key_exists($calledClass, self::$allPersisted)) {
      return self::$allPersisted[$calledClass];
    } else {
      $persisted = [];
      if(property_exists($calledClass, 'persisted')) {
        $persisted  = $calledClass::$persisted;
      }
      $parent = get_parent_class($calledClass);
      if (method_exists($parent, 'getAllPersistedAttributes')) {
        $persisted = array_merge($persisted, $parent::getAllPersistedAttributes());
      }
    }
    self::$allPersisted[$calledClass] = $persisted;
    return self::$allPersisted[$calledClass];
  }