private function hasMain($arrayCollection, &$mainEntity = null)
    {
        if ($arrayCollection && !$arrayCollection->isEmpty()) {
            return $arrayCollection->exists(
                function($index, $entity) {
                    $mainEntity = $entity;

                    return true === $entity->getMain();
                }
            );
        }

        return false;
    }