public function findModelStates($workflowIdentifier, $processName, $successOnly)
    {
        $qb = $this->createQueryBuilder('ms')
            ->andWhere('ms.workflowIdentifier = :workflow_identifier')
            ->andWhere('ms.processName = :process')
            ->orderBy('ms.createdAt', 'ASC')
            ->setParameter('workflow_identifier', $workflowIdentifier)
            ->setParameter('process', $processName)
        ;

        if ($successOnly) {
            $qb->andWhere('ms.successful = :success')
                ->setParameter('success', true);
        }

        return $qb->getQuery()->getResult();
    }