private void CreateIdNameMappingForOrganization(NormalizedOrganization organization)
        {
            if (organization != null)
            {
                if (organization.Id != null)
                {
                    List <NormalizedOrganization> organizationIdsOrganizations;

                    if (!this.OrganizationIdsToOrganizations.TryGetValue(organization.Id, out organizationIdsOrganizations))
                    {
                        organizationIdsOrganizations = new List <NormalizedOrganization>();
                    }

                    organizationIdsOrganizations.Add(organization);

                    this.OrganizationIdsToOrganizations[organization.Id] = organizationIdsOrganizations;
                }

                if (organization.Name != null)
                {
                    List <NormalizedOrganization> organizationNamesOrganizations;

                    if (!this.OrganizationIdsToOrganizations.TryGetValue(organization.Name, out organizationNamesOrganizations))
                    {
                        organizationNamesOrganizations = new List <NormalizedOrganization>();
                    }

                    organizationNamesOrganizations.Add(organization);

                    this.OrganizationIdsToOrganizations[organization.Name] = organizationNamesOrganizations;
                }
            }
        }
        public static NormalizedOrganization TryParseFromSection(RawWhoisSection section)
        {
            if (organizationTypes.Contains(section.Type))
            {
                var organization = new NormalizedOrganization()
                {
                    Location = NormalizedLocation.TryParseFromSection(section),
                    Phone    = NormalizationUtils.FindFirstMatchingFieldValueInRecords(section, phoneFields)
                };

                NormalizationUtils.ExtractCommonRecordMetadata(section, section.Id, nameFields, organization);

                return(organization);
            }

            return(null);
        }
        public void LoadOrganizations(IEnumerable <string> filePaths)
        {
            if (filePaths == null)
            {
                throw new ArgumentNullException("filePaths");
            }

            foreach (var filePath in filePaths)
            {
                foreach (var section in this.Parser.RetrieveSections(filePath))
                {
                    var organization = NormalizedOrganization.TryParseFromSection(section);

                    if (organization != null && organization.Location.AddressSeemsValid())
                    {
                        this.CreateIdNameMappingForOrganization(organization);
                    }
                }
            }
        }