/// <summary>
            /// Unlock the gift card.
            /// </summary>
            /// <param name="request">The request.</param>
            /// <returns>
            /// A response containing the gift card.
            /// </returns>
            private static NullResponse UnlockGiftCard(UnlockGiftCardServiceRequest request)
            {
                if (request == null)
                {
                    throw new ArgumentNullException("request");
                }

                var unlockRequest = new UnlockGiftCardRealtimeRequest(request.GiftCardId);

                request.RequestContext.Execute <NullResponse>(unlockRequest);

                return(new NullResponse());
            }
            /// <summary>
            /// Unlocks the gift card.
            /// </summary>
            /// <param name="context">Request context.</param>
            /// <param name="giftCardId">Gift card identifier.</param>
            private static void UnlockGiftCard(RequestContext context, string giftCardId)
            {
                // Unlock gift cards on sales lines
                var unlockGiftCardRequest = new UnlockGiftCardServiceRequest(giftCardId);

                try
                {
                    context.Execute <NullResponse>(unlockGiftCardRequest);
                }
                catch (Exception ex)
                {
                    // Inform the cashier that the gift card could not be unlocked.
                    throw new DataValidationException(
                              DataValidationErrors.Microsoft_Dynamics_Commerce_Runtime_GiftCardUnlockFailed,
                              null,
                              ex,
                              string.Format("Exception while trying to unlock gift card: {0}", giftCardId));
                }
            }