public static function createOrRefreshUser($username,$individualGroupAssignmentOptions = null) {
        if(static::getExtensionOptions('ENABLE_YII2_PROFILING') == true) {
            Yii::beginProfile('createOrRefreshUser', static::YII2_PROFILE_NAME . 'createOrRefreshUser');
        }
        
        $userObjectDb = static::findOne(['username' => $username]); 

        //Create user if not found in db
        if ($userObjectDb == null) {        
            $userObjectDb = static::createNewUser($username, $individualGroupAssignmentOptions);
        } else {
            $userObjectDb->setIndividualGroupAssignmentOptions($individualGroupAssignmentOptions);
            $userObjectDb->updateAccountStatus();
            $userObjectDb->updateGroupAssignment();
        }
        
        if(static::getExtensionOptions('ENABLE_YII2_PROFILING') == true) {
            Yii::endProfile('createOrRefreshUser', static::YII2_PROFILE_NAME . 'createOrRefreshUser');
        }        
        return $userObjectDb;
    }