class MultiRepositoryManager {

    public void addRepositoryToFile(List<RepositoryProperties> repositories) {
        IRepository repo = RepositoryFactory.getRepository();
        if (!(repo instanceof MultiRepository)) {
            initializeRepositoryListForMultiRepositoryAndReconfigureFactory(repositories);
            repo = RepositoryFactory.getRepository();
        }
        ((MultiRepository) repo).addRepositoryToFile(repositories);
    }

}