private void BuildPublicView(ModuleInstanceView parent, IDictionary<string, string> parameters)
        {
            var searchRequest = BuildRequest(parent, parameters);
            var searchResponse = parent.ProcessRequest<SearchProviderSpecialtiesResponse>(searchRequest);
            var providerSearchResultsPageUrl = _viewSettings.GetSettingValue("DetailPageUrl", string.Empty);

            if (searchResponse.Specialties.Any())
            {
                using (new IhMonitoredScope("Populate field data"))
                {
                    var record = new Record();
                    record.StaticPageZones = _viewSettings.StaticPageZones.Select(z => new KeyValuePair<string, PageZone>(z.Key, (PageZone)z.Value.Clone())).ToList();
                    record.DynamicPageZones = _viewSettings.DynamicPageZones.Select(z => (PageZone)z.Clone()).ToList();
                    foreach (var pageZone in record.StaticPageZones.Select(z => z.Value).Union(record.DynamicPageZones))
                    {
                        foreach (var column in pageZone.FieldColumns)
                        {
                            foreach (var field in column.Fields)
                            {
                                if (field.FieldName == "SpecialtiesList")
                                    field.Value = GetSpecialtyListMarkup(searchResponse, providerSearchResultsPageUrl);
                            }
                        }
                    }

                    _viewSettings.Records.Add(record);
                }
            }
        }
        private void ProcessSearchResponse(SearchOrgUnitsResponse searchResponse)
        {
            foreach (var location in searchResponse.Results)
            {
                var record = new Record();

                _dynamicColumnData = location.DynamicColumns;

                record.StaticPageZones = _viewSettings.StaticPageZones.Select(z => new KeyValuePair<string, PageZone>(z.Key, (PageZone)z.Value.Clone())).ToList();
                record.DynamicPageZones = _viewSettings.DynamicPageZones.Select(z => (PageZone)z.Clone()).ToList();
                foreach (var pageZone in record.StaticPageZones.Select(z => z.Value).Union(record.DynamicPageZones))
                {
                    foreach (var column in pageZone.FieldColumns)
                    {
                        foreach (var field in column.Fields)
                        {
                            PopulateFieldData(location, field);
                        }
                    }
                }
                _viewSettings.Records.Add(record);
                _viewSettings.MapItems.Add(BuildMapItem(location, searchResponse.Results.ToList().IndexOf(location)));
            }
        }
        private void ProcessSearchResponse(SearchEventsPortalResponse searchResponse)
        {
            foreach (var eventResult in searchResponse.Results)
            {
                var record = new Record();

                _dynamicColumnData = eventResult.DynamicColumns;

                record.StaticPageZones = _viewSettings.StaticPageZones.Select(z => new KeyValuePair<string, PageZone>(z.Key, (PageZone)z.Value.Clone())).ToList();
                record.DynamicPageZones = _viewSettings.DynamicPageZones.Select(z => (PageZone)z.Clone()).ToList();
                foreach (var pageZone in record.StaticPageZones.Select(z => z.Value).Union(record.DynamicPageZones))
                {
                    foreach (var column in pageZone.FieldColumns)
                    {
                        foreach (var field in column.Fields)
                        {
                            PopulateFieldData(eventResult, field);
                        }
                    }
                }

                _viewSettings.Records.Add(record);
            }
        }
        private void ProcessSearchResponse(SearchProvidersResponse searchResponse)
        {
            using (new IhMonitoredScope("Populate field data"))
            {
                var providerIndex = 0;

                foreach (var provider in searchResponse.Results)
                {
                    var record = new Record();

                    _dynamicColumnData = provider.DynamicColumns;

                    record.StaticPageZones = _viewSettings.StaticPageZones.Select(z => new KeyValuePair<string, PageZone>(z.Key, (PageZone)z.Value.Clone())).ToList();
                    record.DynamicPageZones = _viewSettings.DynamicPageZones.Select(z => (PageZone)z.Clone()).ToList();

                    foreach (var pageZone in record.StaticPageZones.Select(z => z.Value).Union(record.DynamicPageZones))
                    {
                        foreach (var column in pageZone.FieldColumns)
                        {
                            List<Field> boardCertificationsFieldList = null;
                            foreach (var field in column.Fields)
                            {
                                if (field.FieldName == "BoardCertification")
                                {
                                    boardCertificationsFieldList = ProviderModuleUtils.PopulateBoardCertificationsFieldData(_view, provider, field);
                                    field.FieldName = "ReplacedBoardCertifications";
                                }
                                else
                                {
                                    PopulateFieldData(provider, field);
                                }
                            }

                            //Replace Board Certifications Complex Field with correct field list
                            if (boardCertificationsFieldList != null)
                            {
                                var index = column.Fields.IndexOf(column.Fields.First(f => f.FieldName == "ReplacedBoardCertifications"));
                                column.Fields.InsertRange(index, boardCertificationsFieldList);
                                index = column.Fields.IndexOf(column.Fields.First(f => f.FieldName == "ReplacedBoardCertifications"));
                                column.Fields.RemoveAt(index);
                            }
                        }
                    }

                    _viewSettings.Records.Add(record);
                    _viewSettings.MapItems.Add(BuildMapItem(provider, providerIndex));

                    providerIndex++;
                }
            }
        }
        private void BuildPublicView(IDictionary<string, string> parameters)
        {
            SetPageSizes();

            _viewSettings.PagerPosition = _view.SearchSettings.PagerPosition;

            int pageNumber = 1;
            int pageSize = _view.SearchSettings.DefaultPageSize;

            if (parameters.ContainsKey("Command"))
            {
                if (parameters["Command"] == "ChangePage")
                {
                    pageNumber = _viewSettings.PageNumber;
                    pageSize = _viewSettings.PageSize;
                }
            }

            var searchRequest = BuildRequest(parameters, pageSize, pageNumber);
            var searchResponse = _view.ProcessRequest<ServicesSearchResponse>(searchRequest);

            _viewSettings.PageNumber = pageNumber;
            _viewSettings.PageSize = pageSize;
            _viewSettings.NumberOfRecords = searchResponse.TotalRecords;

            _viewSettings.Records.Clear();
            _viewSettings.MapItems.Clear();

            foreach (var service in searchResponse.Results)
            {
                var record = new Record();

                record.StaticPageZones = _viewSettings.StaticPageZones.Select(z => new KeyValuePair<string, PageZone>(z.Key, (PageZone)z.Value.Clone())).ToList();
                record.DynamicPageZones = _viewSettings.DynamicPageZones.Select(z => (PageZone)z.Clone()).ToList();
                foreach (var pageZone in record.StaticPageZones.Select(z => z.Value).Union(record.DynamicPageZones))
                {
                    foreach (var column in pageZone.FieldColumns)
                    {
                        foreach (var field in column.Fields)
                        {
                            PopulateFieldData(service, field);
                        }
                    }
                }
                _viewSettings.Records.Add(record);
            }

            // Add SEO data to the response
            PopulateSeoData(parameters);
        }