private function addWhereOptionalField(QueryBuilder $qb, $field, $value): void
    {
        if (null === $value) {
            $qb->andWhere('p.'.$field.' IS NULL');
        } else {
            $qb->andWhere('p.'.$field.' = :'.$field)->setParameter($field, $value);
        }
    }