private function writeFields($fields, ApiInterface $entity, bool $writeChildren): bool {
        $isChanged = false;
        foreach($fields as $name => $value) {
            if($this->getAcl()->canWriteField($entity, $name)) {
                try {
                    if(array_key_exists($name, $entity->getChildrenUpdaters())) {
                        if($writeChildren) {
                            $entity->getChildrenUpdaters()[$name]->setData($entity, $value);
                            $isChanged = true;
                        }
                    } else {
                        $entity->writeAttribute($name, $value);
                    }
                } catch(\InvalidArgumentException $e) {
                    throw new CatchableException($e->getMessage());
                }
            }
        }
        return $isChanged;
    }