// This method was introduced breaking the previously used Singleton pattern.
    // This was done in order to support multiple networks concurrently.
    // We can now have multiple RAIDA objects each containing different networks
    // RAIDA details are read from Directory URL first.
    // In case of failure, it falls back to a file on the file system
    public static List <RAIDA> Instantiate()
    {
        string nodesJson = "";

        networks.Clear();
        using (WebClient client = new WebClient())
        {
            try
            {
                nodesJson = client.DownloadString(Config.URL_DIRECTORY);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                if (System.IO.File.Exists("directory.json"))
                {
                    nodesJson = System.IO.File.ReadAllText(Environment.CurrentDirectory + @"\directory.json");
                }
                else
                {
                    Exception raidaException = new Exception("RAIDA instantiation failed. No Directory found on server or local path");
                    throw raidaException;
                }
            }
        }

        try
        {
            RAIDADirectory dir = JsonConvert.DeserializeObject <RAIDADirectory>(nodesJson);

            foreach (var network in dir.networks)
            {
                networks.Add(RAIDA.GetInstance(network));
            }
        }
        catch (Exception e)
        {
            Exception raidaException = new Exception("RAIDA instantiation failed. No Directory found on server or local path");
            throw raidaException;
        }
        if (networks == null)
        {
            Exception raidaException = new Exception("RAIDA instantiation failed. No Directory found on server or local path");
            throw raidaException;
        }
        if (networks.Count == 0)
        {
            Exception raidaException = new Exception("RAIDA instantiation failed. No Directory found on server or local path");
            throw raidaException;
        }
        return(networks);
    }
 private static int GetNetworkNumber(RAIDADirectory dir)
 {
     return(1);
 }