public function getBean($module, $id = null, $params = array(), $deleted = true, $useCache = false)
    {
        if ($useCache && class_exists('BeanFactory')) {
            return \BeanFactory::getBean($module, $id, $params, $deleted);
        }

        // If I use an old version of SugarCRM, do exactly what BeanFactory does
        // Check if params is an array, if not use old arguments
        if (isset($params) && !is_array($params)) {
            $params = array('encode' => $params);
        }

        // Pull values from $params array
        $encode = isset($params['encode']) ? $params['encode'] : true;
        $deleted = isset($params['deleted']) ? $params['deleted'] : $deleted;
        // Module exists? Load it
        if (!array_key_exists($module, $this->beanList)) {
            throw new \InvalidArgumentException($module . ' does not exist in SugarCRM, I cannot retrieve anything');
        }

        $beanClass = $this->beanList[$module];
        if (!class_exists($beanClass)) {
            throw new SugarException("Class $beanClass does not exist");
        }

        $bean = new $beanClass();
        if (!is_null($id)) {
            $this->getLogger()->debug($this->logPrefix . "Retrieving $module with ID '$id' (deleted = $deleted)");
            // to change the parent bean, but not the related (e.g. change Account Name of Opportunity)
            if (!empty($params['disable_row_level_security'])) {
                $bean->disable_row_level_security = true;
            }
            $result = $bean->retrieve($id, $encode, $deleted);
            if (is_null($result)) {
                $this->getLogger()->info($this->logPrefix . 'Nothing to retrieve.');

                return false;
            }
        }

        return $bean;
    }