/// <inheritdoc />
        public async Task <decimal> GetRemainingInboundTransferQuantity(InboundTransfer inboundTransfer)
        {
            var workItemQuantity = await GetTotalInboundTransferWorkItemQuantity(inboundTransfer?.TransferNumber).ConfigureAwait(false);

            // Ensure we don't have an invalid quantity.
            if (workItemQuantity <= 0)
            {
                return(inboundTransfer?.OriginalQty ?? 0);
            }

            var remainingQty = inboundTransfer?.OriginalQty ?? 0 - workItemQuantity;

            return(remainingQty < 0
                ? 0
                : remainingQty);
        }
 private async Task <InboundTransfer> FilterInboundTransfer(
     InboundTransfer inboundTransfer
     ) => await DoesTransferWorkItemExist(inboundTransfer?.TransferNumber).ConfigureAwait(false)
     ? null
     : inboundTransfer;
 /// <summary>
 ///     Filter the provided InboundTransfer instance.
 /// </summary>
 /// <param name="inboundTransfer">The InboundTransfer instance to filter.</param>
 /// <returns>
 ///     An asynchronous Task that returns the provided InboundTransfer instance when
 ///     it has a remaining quantity. Else, null.
 /// </returns>
 private async Task <InboundTransfer> FilterInboundTransferByQuantity(
     InboundTransfer inboundTransfer
     ) => await GetRemainingInboundTransferQuantity(inboundTransfer).ConfigureAwait(false) > 0
     ? inboundTransfer
     : null;