public ReservationModel ConfirmAvailability(ReservationModel reservationModel, Credential userCredential)
            {
                var wsRnd = new ServicioPruebaHeredado();

                var roomTypes = CacheData.NemoRoomTypes;

                try
                {
                    foreach (var vacancy in reservationModel.Vacancies)
                    {
                        var rqHotelAvail = new WSHCEV_main.HotelRoomPricedInventorySearchRQ();
                        var x            = new System.Xml.Serialization.XmlSerializer(rqHotelAvail.GetType());
                        var sw           = new System.IO.StringWriter();
                        var xw           = new System.Xml.XmlTextWriter(sw);

                        rqHotelAvail.Source = new WSHCEV_main.Source();
                        rqHotelAvail.Source.PricingSurferConfiguration = new WSHCEV_main.PricingSurferConfiguration();
                        rqHotelAvail.Source.PricingSurferConfiguration.PreferedLanguage            = new WSHCEV_main.PreferedLanguage();
                        rqHotelAvail.Source.PricingSurferConfiguration.PreferedCurrency            = new WSHCEV_main.PreferedCurrency();
                        rqHotelAvail.Source.PricingSurferConfiguration.ResponseSet                 = new WSHCEV_main.ResponseSet();
                        rqHotelAvail.Source.PricingSurferConfiguration.ResponseSet.SortingCriteria = new WSHCEV_main.SortingCriteria();
                        rqHotelAvail.Source.PricingSurferConfiguration.ContractId = 10273; // 10857;
                        rqHotelAvail.Source.PricingSurferConfiguration.PreferedLanguage.LanguageCode          = "es";
                        rqHotelAvail.Source.PricingSurferConfiguration.PreferedCurrency.CurrencyCode          = "USD";
                        rqHotelAvail.Source.PricingSurferConfiguration.ResponseSet.FirstItem                  = 1;
                        rqHotelAvail.Source.PricingSurferConfiguration.ResponseSet.ItemsPerPage               = 10000;
                        rqHotelAvail.Source.PricingSurferConfiguration.ResponseSet.SortingCriteria.ItemsCount = 1;
                        rqHotelAvail.Source.PricingSurferConfiguration.ResponseSet.SortingCriteria.SortField  = new WSHCEV_main.SortField[] { new WSHCEV_main.SortField {
                                                                                                                                                  Sequence = 1, OrderBy = "ASC", SortFieldName = "name"
                                                                                                                                              } };

                        rqHotelAvail.Details                = new WSHCEV_main.HotelRoomPricedInventorySearchRQDetails();
                        rqHotelAvail.Details.Criterion      = new WSHCEV_main.HotelRoomPricedInventorySearchRQDetailsCriterion();
                        rqHotelAvail.Details.Criterion.Stay = new WSHCEV_main.Stay();

                        rqHotelAvail.Details.Criterion.Availability = "NMO.HTL.AVB.ALL";

                        rqHotelAvail.Details.Criterion.Stay.DestinationDetails             = new WSHCEV_main.DestinationDetails();
                        rqHotelAvail.Details.Criterion.Stay.DestinationDetails.Destination = new WSHCEV_main.Destination[] {
                            new WSHCEV_main.Destination {
                                Sequence        = 1,
                                DestinationCode = reservationModel.DestinationId,
                                DestinationType = "NMO.HTL.DST.CTY"
                            }
                        };

                        rqHotelAvail.Details.Criterion.Stay.DestinationDetails.ItemsCount = 1;

                        rqHotelAvail.Details.Criterion.Stay.CheckIn  = reservationModel.Vacancies.First().VacancyCheckin;
                        rqHotelAvail.Details.Criterion.Stay.CheckOut = reservationModel.Vacancies.First().VacancyCheckout;

                        rqHotelAvail.Details.Criterion.Stay.Rooms = new WSHCEV_main.AvailRequestRooms();

                        uint i            = 1;
                        var  requestRooms = new List <WSHCEV_main.AvailRequestRoom>();

                        foreach (var room in vacancy.Rooms)
                        {
                            requestRooms.Add(new WSHCEV_main.AvailRequestRoom
                            {
                                Sequence = i++,
                                RoomType = MapFromRoomType(room.RoomType),
                                Guests   = new WSHCEV_main.Guests
                                {
                                    Guest = GetRequestGuests(room.ChildrenAges, GetAdultsByRoomType(room.RoomType)).ToArray()
                                }
                            });
                        }

                        rqHotelAvail.Details.Criterion.RateID = vacancy.VacancyId;

                        rqHotelAvail.Details.Criterion.Stay.Rooms.Room = requestRooms.ToArray();

                        rqHotelAvail.Details.Criterion.HotelCodes = new WSHCEV_main.HotelCodes
                        {
                            ItemsCount = 1,
                            HotelCode  = new WSHCEV_main.HotelCode[]
                            {
                                new WSHCEV_main.HotelCode
                                {
                                    SupplierID = reservationModel.LodgingSupplierId,
                                    Value      = reservationModel.LodgingId
                                }
                            },
                            OrderBy = "ASC"
                        };

                        xw.Formatting = System.Xml.Formatting.None;
                        x.Serialize(xw, rqHotelAvail);

                        wsRnd.Timeout = 30000;
                        var response = wsRnd.HotelAvail(sw.ToString());
                        var sr       = new StringReader(response);

                        x = new System.Xml.Serialization.XmlSerializer(typeof(WSHCEV_main.HotelRoomPricedInventorySearchRS));
                        var lodgingListRS = (WSHCEV_main.HotelRoomPricedInventorySearchRS)x.Deserialize(sr);
                        sr.Close();

                        if (lodgingListRS != null && lodgingListRS.Item is WSHCEV_main.HotelRoomPricedInventorySearchRSDetails &&
                            ((WSHCEV_main.HotelRoomPricedInventorySearchRSDetails)lodgingListRS.Item).TinyHotels != null)
                        {
                            var lodgings = ((WSHCEV_main.HotelRoomPricedInventorySearchRSDetails)lodgingListRS.Item).TinyHotels;

                            foreach (var lodging in lodgings)
                            {
                                var rate = lodging.Rates.First(r => r.RateID == vacancy.VacancyId);

                                if (rate != null)
                                {
                                    vacancy.Available             = true;
                                    vacancy.ConfirmedVacancyPrice = (decimal)(rate.RatePrices.FirstOrDefault().Value /
                                                                              (reservationModel.Vacancies.First().VacancyCheckout - reservationModel.Vacancies.First().VacancyCheckin).TotalDays);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                }

                return(reservationModel);
            }
            //public LodgingListModel SearchLodging(string destinationId, string destinationType, string lodgingType,
            //    DateTime checkin, DateTime checkout,
            //    int room1, int room2, int room3, int room4, int room5, int room6, string order, CheckArgentina.Models.Credential userCredential)
            //{

            public LodgingListModel SearchLodging(SearchLodgingRequestModel searchLodgingRequestModel, Credential userCredential)
            {
                SessionData.SearchType = SearchType.International;

                var results  = new LodgingListModel();
                var lodgings = new List <LodgingModel>();

                var rqHotelAvail = new WSHCEV_main.HotelRoomPricedInventorySearchRQ();
                var x            = new System.Xml.Serialization.XmlSerializer(rqHotelAvail.GetType());
                var sw           = new System.IO.StringWriter();
                var xw           = new System.Xml.XmlTextWriter(sw);
                var wsRnd        = new ServicioPruebaHeredado();

                var roomTypes = CacheData.NemoRoomTypes;

                try
                {
                    rqHotelAvail.Source = new WSHCEV_main.Source();
                    rqHotelAvail.Source.PricingSurferConfiguration = new WSHCEV_main.PricingSurferConfiguration();
                    rqHotelAvail.Source.PricingSurferConfiguration.PreferedLanguage            = new WSHCEV_main.PreferedLanguage();
                    rqHotelAvail.Source.PricingSurferConfiguration.PreferedCurrency            = new WSHCEV_main.PreferedCurrency();
                    rqHotelAvail.Source.PricingSurferConfiguration.ResponseSet                 = new WSHCEV_main.ResponseSet();
                    rqHotelAvail.Source.PricingSurferConfiguration.ResponseSet.SortingCriteria = new WSHCEV_main.SortingCriteria();
                    rqHotelAvail.Source.PricingSurferConfiguration.ContractId = 10273; // 10857;
                    rqHotelAvail.Source.PricingSurferConfiguration.PreferedLanguage.LanguageCode          = "es";
                    rqHotelAvail.Source.PricingSurferConfiguration.PreferedCurrency.CurrencyCode          = "USD";
                    rqHotelAvail.Source.PricingSurferConfiguration.ResponseSet.FirstItem                  = 1;
                    rqHotelAvail.Source.PricingSurferConfiguration.ResponseSet.ItemsPerPage               = 10000;
                    rqHotelAvail.Source.PricingSurferConfiguration.ResponseSet.SortingCriteria.ItemsCount = 1;
                    rqHotelAvail.Source.PricingSurferConfiguration.ResponseSet.SortingCriteria.SortField  = new WSHCEV_main.SortField[] { new WSHCEV_main.SortField {
                                                                                                                                              Sequence = 1, OrderBy = "ASC", SortFieldName = "name"
                                                                                                                                          } };

                    rqHotelAvail.Details                = new WSHCEV_main.HotelRoomPricedInventorySearchRQDetails();
                    rqHotelAvail.Details.Criterion      = new WSHCEV_main.HotelRoomPricedInventorySearchRQDetailsCriterion();
                    rqHotelAvail.Details.Criterion.Stay = new WSHCEV_main.Stay();

                    rqHotelAvail.Details.Criterion.Availability = "NMO.HTL.AVB.ALL";

                    rqHotelAvail.Details.Criterion.Stay.DestinationDetails             = new WSHCEV_main.DestinationDetails();
                    rqHotelAvail.Details.Criterion.Stay.DestinationDetails.Destination = new WSHCEV_main.Destination[] {
                        new WSHCEV_main.Destination {
                            Sequence        = 1,
                            DestinationCode = searchLodgingRequestModel.DestinationId,
                            DestinationType = "NMO.HTL.DST.CTY"
                        }
                    };

                    rqHotelAvail.Details.Criterion.Stay.DestinationDetails.ItemsCount = 1;

                    rqHotelAvail.Details.Criterion.Stay.CheckIn  = searchLodgingRequestModel.Checkin;
                    rqHotelAvail.Details.Criterion.Stay.CheckOut = searchLodgingRequestModel.Checkout;

                    rqHotelAvail.Details.Criterion.Stay.Rooms = new WSHCEV_main.AvailRequestRooms();

                    uint i            = 1;
                    var  requestRooms = searchLodgingRequestModel.Rooms.Select(r => new WSHCEV_main.AvailRequestRoom
                    {
                        Sequence = i++,
                        RoomType = r.RoomTypeCode,
                        Guests   = new WSHCEV_main.Guests
                        {
                            Guest = GetRequestGuests(r.ChildrenAges, GetAdultsByRoomType(r.RoomType)).ToArray()
                        }
                    });

                    rqHotelAvail.Details.Criterion.Stay.Rooms.Room = requestRooms.ToArray();

                    xw.Formatting = System.Xml.Formatting.None;
                    x.Serialize(xw, rqHotelAvail);

                    wsRnd.Timeout = 30000;
                    var response = wsRnd.HotelAvail(sw.ToString());
                    var sr       = new StringReader(response);

                    x = new System.Xml.Serialization.XmlSerializer(typeof(WSHCEV_main.HotelRoomPricedInventorySearchRS));
                    var lodgingListRS = (WSHCEV_main.HotelRoomPricedInventorySearchRS)x.Deserialize(sr);
                    sr.Close();

                    if (lodgingListRS != null && lodgingListRS.Item is WSHCEV_main.HotelRoomPricedInventorySearchRSDetails &&
                        ((WSHCEV_main.HotelRoomPricedInventorySearchRSDetails)lodgingListRS.Item).TinyHotels != null)
                    {
                        lodgings = ((WSHCEV_main.HotelRoomPricedInventorySearchRSDetails)lodgingListRS.Item).TinyHotels
                                   .Where(l => l.Rates.Count(r => r.Offer == WSHCEV_main.BooleanEnum.False) > 0).Select(l => new LodgingModel
                        {
                            LodgingId           = l.Code,
                            LodgingName         = l.Name,
                            LodgingDescription  = "",
                            LodgingCategory     = (int)l.Rating.Value,
                            LodgingCurrency     = l.Rates.First().RatePrices.First().Currency, //"U$S"
                            LodgingCurrencyCode = MapCurrencyToNPS(l.Rates.First().RatePrices.First().Currency),
                            LodgingPrice        = (decimal)l.Rates.First().RatePrices.First().Value,
                            LodgingSupplierId   = l.SupplierID,
                            Vacancies           = l.Rates.Where(r => r.Offer == WSHCEV_main.BooleanEnum.False).Select(r => new VacancyModel
                            {
                                LodgingId       = l.Code,
                                LodgingName     = l.Name,
                                LodgingCurrency = r.RatePrices.First().Currency,
                                VacancyId       = r.RateID,
                                VacancyName     = r.Rooms.First().Value + " / " + r.Boards.First().Value,
                                VacancyPrice    = (decimal)(r.RatePrices.First().Value / (searchLodgingRequestModel.Checkout - searchLodgingRequestModel.Checkin).TotalDays),
                                VacancyCheckin  = searchLodgingRequestModel.Checkin,
                                VacancyCheckout = searchLodgingRequestModel.Checkout,
                                VacancyDates    = GetDatesBetween(searchLodgingRequestModel.Checkin, searchLodgingRequestModel.Checkout),
                                VacancyCount    = 99,

                                Rooms = r.Rooms.Select(rr => new RoomModel {
                                    RoomId    = rr.RoomID.ToString(),
                                    RoomName  = rr.Value,
                                    RoomCount = 1
                                }).ToList()
                            }).ToList()
                        }).ToList();
                    }
                }
                catch (Exception ex)
                {
                }

                results.Lodgings = lodgings;

                return(results);
            }