private static void Init()
        {
            // load db and configuration
            string currentDir = Directory.GetCurrentDirectory();

            DbReader.DbFile = (Path.Combine(currentDir, "db.json"));
            db     = DbReader.Load();
            config = ConfigReader.Get(currentDir, "config.json");

            downloadFolder = Path.GetFullPath(Path.Combine(currentDir, (string)config.downloadFolder));
            Directory.CreateDirectory(downloadFolder);

            // setup the client
            Configuration clientConfig = new Configuration();

            clientConfig.Timeout = (int)config.timeout;
            clientConfig.setApiClientUsingDefault();
            clientConfig.AddApiKey("api_key_both", (string)config.apiPwd);

            clientConfig.ApiClient = new ApiClient((string)config.basePath);

            bundlesApi = new BundlesApi(clientConfig);

            RestClient client = bundlesApi.Configuration.ApiClient.RestClient;

            //X509Certificate cert = CertificateReader.LoadFromPemFile(Path.GetFullPath(Path.Combine(currentDir, (string)config.crt.cert)));
            //client.ClientCertificates = new X509CertificateCollection{ cert };

            Console.WriteLine("Api calls will be sent to: \"" + bundlesApi.GetBasePath() + "\".");

            // The timer for checking new files in the local directory
            recheckTimer          = new Timer((double)config.interval);
            recheckTimer.Elapsed += new ElapsedEventHandler(
                async(object source, ElapsedEventArgs evt) =>
            {
                try
                {
                    // Queue the recheck on the thread pool because
                    // synchronization back into this context isn't needed
                    // flags are used to prevent the application from exiting early
                    await Task.Run(async() =>
                    {
                        await DoRecheckBundles(source, evt);
                    });
                }
                catch (ApiException e)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.Error.WriteLine(
                        "An Api Exception occured:\n\tMessage: " + e.Message +
                        "\n\tHTTP Status Code: " + e.ErrorCode +
                        "\n\tBody: " + e.ErrorContent
                        );
                    Console.ResetColor();
                }
            }
                );
            Console.WriteLine("The available bundles will be checked every " + recheckTimer.Interval + " ms and saved to  \"" + downloadFolder + "\" .");
        }
        public static void Save(DbObject dbObject)
        {
            if (_File == "")
            {
                throw new InvalidOperationException("There has't been a db file specified.");
            }
            string json = JsonConvert.SerializeObject(dbObject, Formatting.Indented);

            File.WriteAllText(_File, json);
        }