private function writeCustomParents($fields, ApiInterface $entity) {
        foreach($entity->getCustomParentRelationships() as $customRelationship) {
            $name = $customRelationship->getReferencedFields();
            if(array_key_exists($name, $fields)) {
                $entity->writeAttribute($name, $fields[$name]);
            }
        }
    }