public function addTarget(Target $target): Target
    {
        $query = $this->connection->createQueryBuilder()
            ->insert('ngbm_rule_target')
            ->values(
                [
                    'id' => ':id',
                    'status' => ':status',
                    'rule_id' => ':rule_id',
                    'type' => ':type',
                    'value' => ':value',
                ]
            )
            ->setValue(
                'id',
                $target->id !== null ?
                    (int) $target->id :
                    $this->connectionHelper->getAutoIncrementValue('ngbm_rule_target')
            )
            ->setParameter('status', $target->status, Type::INTEGER)
            ->setParameter('rule_id', $target->ruleId, Type::INTEGER)
            ->setParameter('type', $target->type, Type::STRING)
            ->setParameter('value', $target->value, is_array($target->value) ? Type::JSON_ARRAY : Type::STRING);

        $query->execute();

        $target->id = $target->id ?? (int) $this->connectionHelper->lastInsertId('ngbm_rule_target');

        return $target;
    }