public object Deserialize(RestResponse response)
        {
            var root   = XDocument.Parse(response.Content).Root;
            var cities = root.Descendants("cities");

            var result = new CitySearchResult()
            {
                Cities = new SearchResultsList <City>()
                {
                    Total        = int.Parse(root.Attribute("total").Value),
                    Page         = int.Parse(root.Attribute("page").Value),
                    ItemsPerPage = int.Parse(root.Attribute("itemsPerPage").Value)
                }
            };

            result.Cities.AddRange(cities.Select(city => new City()
            {
                State     = city.Attribute("state").Value,
                StateCode = city.Attribute("stateCode").Value,
                Name      = city.Attribute("name").Value,
                Id        = city.Attribute("id").Value,
                Coords    = new Coordinates()
                {
                    Lat  = double.Parse(city.Element("coords").Attribute("lat").Value),
                    Long = double.Parse(city.Element("coords").Attribute("long").Value)
                },
                Country = new Country()
                {
                    Code = city.Element("country").Attribute("code").Value,
                    Name = city.Element("country").Attribute("name").Value
                }
            }));

            return(result);
        }
        public CitySearchResult Get(CitySearchCriteria citySearchCriteria)
        {
            var res = new CitySearchResult();

            try
            {
                res.cityDTOs = cityRepository.GetAsQueryable(citySearchCriteria)
                               .Select(city => new CityDTO
                {
                    Id   = city.Id,
                    Name = city.Name
                }).ToList();

                res.TotalCount = res.cityDTOs.Count;
            }
            catch (Exception ex)
            {
                res.Exception = ex;
                res.Message   = "Error";
            }
            return(res);
        }