public CancellationResponseDto CancelOrder(CancelOrderDto cancelledOrder)
        {
            CheckAccessRights(cancelledOrder.BusinessId);
            Order orderInformation = null;
            int? refundId = null;
            bool? isRefundSuccessful = null;
            bool? isRefundAttempted = false;

            foreach (CancelBookingDto cancelBooking in cancelledOrder.CancelBookings)
            {
                // this is so we only get the order information the first time
                Booking internalBooking = GetBookingAndCheckAccessForCancelBooking(cancelBooking,
                                                                                   orderInformation == null);
                if (orderInformation == null)
                {
                    orderInformation = internalBooking.Order;
                    orderInformation.Bookings = new List<Booking>();
                }

                // update this as it will drive wether the email is sent within the email manager
                internalBooking.CancellationDetails.SendCancellationEmail = cancelledOrder.SendCancellationEmail;
                internalBooking.CancellationDetails.Notes = cancelBooking.Notes;
                bookingManager.CancelBooking(internalBooking, out refundId, out isRefundSuccessful, out isRefundAttempted);

                // add booking to order for send to email
                orderInformation.Bookings.Add(internalBooking);
            }

            // Send email about the cancelled bookings
            if (cancelledOrder.SendCancellationEmail.HasValue && cancelledOrder.SendCancellationEmail.Value)
            {
                orderInformation.GuestMessage = cancelledOrder.GuestNotes;
                emailManager.SendCancellationEmails(orderInformation);
            }
            if (cancelledOrder.CancelBookings.Count > 0)
            {
                eventTrackingManager.CreateBusinessEvent(cancelledOrder.CancelBookings.First().BusinessId, BusinessEventTypesEnum.OrderCancelled, orderInformation.ChannelReference, notes: string.Format("Order '{0}' cancelled: {1}", orderInformation.OrderReference, orderInformation.Notes));   
            }
            
            return new CancellationResponseDto { RefundId = refundId, IsRefundSuccessful = isRefundSuccessful, IsRefundAttempted = isRefundAttempted, Result = true };
        }
            protected override void RunBeforeAllTests()
            {
                base.RunBeforeAllTests();

                PropertyManagementSystemService.FakeAuthenticationForDebugging = true;
                PropertyManagementSystemService.BookingManager = new BookingManager();

                cancelOrderDto = new CancelOrderDto
                {
                    BusinessId = BUSINESS_ID,
                    CancelBookings = new List<CancelBookingDto>
                                                                  {
                                                                      new CancelBookingDto
                                                                          {
                                                                              BookingId = 1,
                                                                              BusinessId = BUSINESS_ID
                                                                          }
                                                                  }
                };

                multiCancelOrderDto = new CancelOrderDto
                {
                    BusinessId = BUSINESS_ID,
                    CancelBookings = new List<CancelBookingDto>
                                                                  {
                                                                      new CancelBookingDto
                                                                          {
                                                                              BookingId = 1,
                                                                              BusinessId = BUSINESS_ID
                                                                          },
                                                                      new CancelBookingDto
                                                                          {
                                                                              BookingId = 2,
                                                                              BusinessId = BUSINESS_ID
                                                                          }
                                                                  }
                };
            }
        public CancellationResponseDto CancelOTAOrder(CancelOrderDto cancelledOrder)
        {
            var order = orderManager.GetOrderWithBookingsByKey(cancelledOrder.OrderId);

            if (order.Bookings == null || !order.Bookings.Any())
            {
                throw new ArgumentException("No bookings!");
            }

            cancelledOrder.CancelBookings = Mapper.Map<List<Booking>, List<CancelBookingDto>>(order.Bookings);

            foreach (var booking in cancelledOrder.CancelBookings)
            {
                booking.Notes = cancelledOrder.Notes;
                booking.CancellationReason = cancelledOrder.CancellationReason;
            }

            return CancelOrder(cancelledOrder);

        }