/// <summary>
        /// Get all the time off mapping entities.
        /// </summary>
        /// <param name="swapShiftRedId">Teams Swap Shift Id.</param>
        /// <returns>Swap Shift Enity.</returns>
        public async Task <SwapShiftMappingEntity> GetKronosReqAsync(string swapShiftRedId)
        {
            var getEntitiesProps = new Dictionary <string, string>()
            {
                { "CurrentCallingAssembly", Assembly.GetCallingAssembly().GetName().Name },
                { "SwapShiftRequestId", swapShiftRedId },
            };

            this.telemetryClient.TrackTrace($"{BusinessLogicResource.GetKronosReqAsync} starts at: {DateTime.UtcNow.ToString("O", CultureInfo.InvariantCulture)}", getEntitiesProps);

            await this.EnsureInitializedAsync().ConfigureAwait(false);

            // Table query
            TableQuery <SwapShiftMappingEntity> query = new TableQuery <SwapShiftMappingEntity>();

            query.Where(TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, swapShiftRedId));

            // Results list
            SwapShiftMappingEntity result            = new SwapShiftMappingEntity();
            TableContinuationToken continuationToken = null;

            if (await this.swapShiftEntityMappingTable.ExistsAsync().ConfigureAwait(false))
            {
                var queryResults = await this.swapShiftEntityMappingTable.ExecuteQuerySegmentedAsync(
                    query,
                    continuationToken).ConfigureAwait(false);

                continuationToken = queryResults.ContinuationToken;
                result            = queryResults.Results?.FirstOrDefault();
            }

            this.telemetryClient.TrackTrace($"{BusinessLogicResource.GetKronosReqAsync} ends at: {DateTime.UtcNow.ToString("O", CultureInfo.InvariantCulture)}", getEntitiesProps);
            return(result);
        }
        /// <summary>
        /// Adds an entity to SwapShiftMapping table.
        /// </summary>
        /// <param name="swapShiftMappingEntity">SwapShiftMappingEntity instance.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public async Task AddOrUpdateSwapShiftMappingAsync(
            SwapShiftMappingEntity swapShiftMappingEntity)
        {
            try
            {
                if (swapShiftMappingEntity is null)
                {
                    throw new ArgumentNullException(nameof(swapShiftMappingEntity));
                }

                await this.azureTableStorageHelper.InsertOrMergeTableEntityAsync(swapShiftMappingEntity, SwapShiftTable).ConfigureAwait(false);
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Gets the mapping that contains the given shift ids.
        /// </summary>
        /// <param name="senderShiftId">The id for the sent shift.</param>
        /// <param name="requestedShiftId">The id for the shift being recieved.</param>
        /// <returns>A SwapShiftMapping Entity.</returns>
        public async Task <SwapShiftMappingEntity> GetMapping(string senderShiftId, string requestedShiftId)
        {
            await this.EnsureInitializedAsync().ConfigureAwait(false);

            // Table query
            TableQuery <SwapShiftMappingEntity> query = new TableQuery <SwapShiftMappingEntity>();

            query.Where(TableQuery.CombineFilters(
                            TableQuery.GenerateFilterCondition(
                                "TeamsOfferedShiftId",
                                QueryComparisons.Equal,
                                senderShiftId),
                            TableOperators.And,
                            TableQuery.GenerateFilterCondition(
                                "TeamsRequestedShiftId",
                                QueryComparisons.Equal,
                                requestedShiftId)));

            // Results list of pending request.
            SwapShiftMappingEntity result            = new SwapShiftMappingEntity();
            TableContinuationToken continuationToken = null;

            if (await this.swapShiftEntityMappingTable.ExistsAsync().ConfigureAwait(false))
            {
                do
                {
                    TableQuerySegment <SwapShiftMappingEntity> queryResults = await this.swapShiftEntityMappingTable.ExecuteQuerySegmentedAsync(
                        query,
                        continuationToken).ConfigureAwait(false);

                    continuationToken = queryResults.ContinuationToken;
                    result            = queryResults.Results?.FirstOrDefault();
                }while (continuationToken != null);
            }

            return(result);
        }