/// <summary>
        /// Gets the list of filter names to be applied to this asset, given filtering parameters.
        /// </summary>
        /// <param name="startTime">The optional start time for filtering.</param>
        /// <param name="endTime">The optional end time for filtering.</param>
        /// <returns>The list of filter names to be applied to this asset.</returns>
        private async Task <List <string> > GetListFiltersAsync(TimeSpan?startTime, TimeSpan?endTime, string uniqueness, string assetName)
        {
            List <string> listFilters = null;

            if (startTime != null || endTime != null)
            {
                string filterName = "filter-time-" + uniqueness;
                PresentationTimeRange presTimeRange = new PresentationTimeRange(
                    startTime?.Ticks,
                    endTime?.Ticks,
                    null,
                    null,
                    TimeSpan.TicksPerSecond);
                listFilters = new List <string>()
                {
                    filterName
                };

                try
                {
                    AssetFilter newAssetFilter = await this.MediaServicesV3SdkWrapper.AssetFiltersCreateOrUpdateAsync(
                        assetName,
                        filterName,
                        new AssetFilter()
                    {
                        PresentationTimeRange = presTimeRange
                    }).ConfigureAwait(false);
                }
                catch (Exception ex)
                {
                    var msg = "AMS v3 Publish. Error when creating asset filter.";
                    var exceptionToThrow = new GridwichPublicationAssetFilterCreateException(
                        assetName,
                        msg,
                        ex);

                    // Providing additional specific details:
                    exceptionToThrow.Data.Add("startTime", startTime?.ToString());
                    exceptionToThrow.Data.Add("endTime", endTime?.ToString());

                    throw exceptionToThrow;
                }
            }

            return(listFilters);
        }
        /// <summary>
        /// Creates a filter which includes all the tracks in the list.
        /// </summary>
        /// <param name="assetName">The asset name.</param>
        /// <param name="filterName">The desired filter name.</param>
        /// <param name="tracksToKeep">The list of tracks to keep.</param>
        private async Task CreateTrackFilterAsync(string assetName, string filterName, List <TrackInfo> tracksToKeep)
        {
            List <FilterTrackSelection> includedTracks = new List <FilterTrackSelection>();

            foreach (TrackInfo track in tracksToKeep)
            {
                var conditions = new List <FilterTrackPropertyCondition>()
                {
                    new FilterTrackPropertyCondition(FilterTrackPropertyType.Type, track.TrackType, FilterTrackPropertyCompareOperation.Equal),
                    new FilterTrackPropertyCondition(FilterTrackPropertyType.Name, track.TrackName, FilterTrackPropertyCompareOperation.Equal)
                };

                includedTracks.Add(new FilterTrackSelection(conditions));
            }

            AssetFilter assetFilterParams = new AssetFilter(tracks: includedTracks);

            try
            {
                AssetFilter newAssetFilter = await this.MediaServicesV3SdkWrapper.AssetFiltersCreateOrUpdateAsync(
                    assetName,
                    filterName,
                    assetFilterParams)
                                             .ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                var msg = "AMS v3 Publish. Error when creating asset filter.";
                var exceptionToThrow = new GridwichPublicationAssetFilterCreateException(
                    assetName,
                    msg,
                    ex);

                // Providing additional specific details:
                exceptionToThrow.SafeAddToData("filterName", filterName);

                throw exceptionToThrow;
            }
        }