public static function deleteEntities(EntityManager $entityManager, $entities, $flushDeleted = true)
    {
        /*
         * No entities provided?
         * Nothing to do
         */
        if (empty($entities)) {
            return false;
        }

        foreach ($entities as $entity) {
            $entityManager->remove($entity);
        }

        // The deleted objects should be flushed?
        if ($flushDeleted) {
            $entityManager->flush();
        }

        return true;
    }