public async Task <CheckoutResource> CreateCheckout(SaveCheckoutResource saveCheckoutResource)
        {
            try
            {
                var validator        = new SaveCheckoutResourceValidator();
                var validationResult = await validator.ValidateAsync(saveCheckoutResource);

                // CHECK IF INFO IS VALID
                if (!validationResult.IsValid)
                {
                    return(new CheckoutResource());
                }

                // MAPPING
                var checkoutToCreate = _mapper.Map <SaveCheckoutResource, Checkout>(saveCheckoutResource);


                // CALL CHECKOUT SERVICE TO CREATE CHECKOUT
                var newCheckout = _checkoutService.CreateCheckout(checkoutToCreate);

                // MAPPING + RESPONSE
                return(_mapper.Map <Checkout, CheckoutResource>(newCheckout));
            }
            catch (Exception ex)
            {
                return(new CheckoutResource());
            }
        }
        public async Task <IActionResult> UpdateCheckout(SaveCheckoutResource saveCheckoutResource)
        {
            try
            {
                SaveCheckoutResourceValidator validator = new SaveCheckoutResourceValidator();
                var validationResult = await validator.ValidateAsync(saveCheckoutResource);

                // Validate if object is well constructed
                if (!validationResult.IsValid)
                {
                    return(BadRequest(validationResult.Errors));
                }

                // Mapping
                Checkout checkoutToUpdate = _mapper.Map <SaveCheckoutResource, Checkout>(saveCheckoutResource);


                // Checkout If Checkout Is Expired And Ticketed
                // Update's the Ticket as well if the second parameter is true
                Ticket oldTicket = await GetExpiredCheckoutsAndApplyTicketByCheckoutId(checkoutToUpdate.Id, true);

                //Update And Return New Checkout
                Checkout newCheckout = _checkoutService.UpdateCheckout(checkoutToUpdate);

                // Return updated checkout
                List <Ticket> checkoutTickets = new List <Ticket>();

                // If there is no ticket, there is no need to adde to checkout object
                if (oldTicket != null)
                {
                    checkoutTickets.Add(oldTicket);
                    newCheckout.Tickets = checkoutTickets;
                }


                return(Ok(newCheckout));
            }
            catch (Exception ex)
            {
                return(NotFound(ex));
            }
        }