public function createRepository($model, $config)
    {
        $defaults = [
            'type' => 'db-soft',
            'key' => 'id',
            'deleted' => 'deleted'
        ];
        $config = array_merge($defaults, $config);
        
        switch ($config['type']) {
            case 'db':
                $repo = new DbRepository($config['db'], $config['table'], $model, $config['key']);
                break;
            case 'db-soft':
                $repo = new SoftDbRepository($config['db'], $config['table'], $model, $config['deleted'], $config['key']);
                break;
            default:
                throw new RepositoryException("Repository type '" . $config['type'] . "' not implemented");
        }
        
        $this->addRepository($repo);
        return $repo;
    }