protected function persist(QuerySet $queries, $entity, $exclusions = [])
    {
        $metadata = $this->getClassMetadata();

        foreach ($metadata->getFieldMappings() as $field) {
            $fieldName = $field['fieldname'];
            if (in_array($fieldName, $exclusions)) {
                continue;
            }
            // Don't add field to the persistence query if it is not an entity
            // property, and on UPDATE only
            if (!isset($entity->$fieldName) && $entity->getId() !== null) {
                continue;
            }

            $field = $this->getFieldManager()->get($field['fieldtype'], $field);
            if ($field instanceof FieldTypeInterface) {
                $field->persist($queries, $entity);
            }
        }
    }