public static function fromConfig($config, UserContext $context)
    {
        $name = $config['username'];
        switch ($config['usertype']) {
            case DirectAdmin::ACCOUNT_TYPE_USER:
                return new self($name, $context, $config);
            case DirectAdmin::ACCOUNT_TYPE_RESELLER:
                return new Reseller($name, $context, $config);
            case DirectAdmin::ACCOUNT_TYPE_ADMIN:
                return new Admin($name, $context, $config);
            default:
                throw new DirectAdminException("Unknown user type '$config[usertype]'");
        }
    }