static public EndpointCollection ReadFromDirectory(string directoryName)
        {
            var retval = new EndpointCollection {
                SourceDirectory = directoryName
            };
            var globalDefaultsFile = Path.Combine(directoryName, "defaults.json");

            var globalDefaults =
                File.Exists(globalDefaultsFile)
                ?
                JsonConvert.DeserializeObject <JSONDefaults>(File.ReadAllText(globalDefaultsFile))
                :
                null;

            if (globalDefaults != null)
            {
                globalDefaults.ThrowExceptionIfAdditionalData();
            }

            foreach (var subdirectory in Directory.GetDirectories(directoryName))
            {
                var endpointFile = Path.Combine(subdirectory, "endpoint.json");
                if (File.Exists(endpointFile))
                {
                    retval.Add(JSONReader.ReadEndpoint(File.ReadAllText(endpointFile), subdirectory, globalDefaults));
                }
            }
            return(retval);
        }
        static public EndpointCollection WithEndpoints(params Endpoint[] endpoints)
        {
            var retval = new EndpointCollection();

            foreach (var endpoint in endpoints)
            {
                retval.Add(endpoint);
            }

            return(retval);
        }