public static async Task <TResult> FindAdaptersByIntgrationAndResourceTypeAsync <TResult>(Guid integrationId, string resourceType,
                                                                                           Guid actorPerformingAs, System.Security.Claims.Claim[] claims,
                                                                                           Func <EastFive.Azure.Synchronization.Adapter[], TResult> onFound,
                                                                                           Func <TResult> onNotFound,
                                                                                           Func <TResult> onUnsupportedResourceType,
                                                                                           Func <TResult> onUnauthorizedIntegration,
                                                                                           Func <TResult> onUnauthorized,
                                                                                           Func <string, TResult> onFailure)
 {
     return(await await ServiceConfiguration.ConnectionsAsync(integrationId, resourceType,
                                                              async (integration, connections) =>
     {
         if (!connections.Any())
         {
             return onUnsupportedResourceType();
         }
         var adaptersAll = await connections     // There really only should be one
                           .Select(
             connection => connection.GetAdaptersAsync(integrationId,
                                                       (adapters) => adapters.Select(
                                                           adapter =>
         {
             adapter.integrationId = integrationId;
             adapter.resourceType = resourceType;
             return adapter;
         }).ToArray(),
                                                       why => new Adapter[] { }))
                           .WhenAllAsync()
                           .SelectManyAsync()
                           .ToArrayAsync();
         return onFound(adaptersAll);
     },
                                                              onNotFound.AsAsyncFunc()));
 }
        internal static async Task <TResult> DeleteAsync <TResult>(
            string resourceKey, string resourceType,
            Guid integrationId,
            Func <TResult> onSuccess,
            Func <TResult> onNotFound,
            Func <string, TResult> onFailure)
        {
            return(await await ServiceConfiguration.ConnectionsAsync(integrationId, resourceType,
                                                                     async (integration, connections) =>
            {
                if (!connections.Any())
                {
                    return onFailure("Unsupported Resource Type");
                }
                return await connections
                .First(         // There really only should be one
                    (connection, next) =>
                {
                    return connection.DeleteAsync(resourceType, resourceKey,
                                                  onSuccess,
                                                  onFailure);
                },
                    () => onFailure("No connection activities could delete the resource.").ToTask());
            },
                                                                     onNotFound.AsAsyncFunc()));



            //var serviceKvps = await context.Integrations.GetActivityAsync<IIntegrate>(integrationId);
            //bool[] results = await serviceKvps
            //    .Select(
            //        async (serviceKvp) =>
            //        {
            //            var service = serviceKvp.Value;
            //            var integrationName = serviceKvp.Key.method;
            //            var connection = this.connections[resourceType](service);
            //            return await connection.DeleteAsync(resourceType, resourceKey,
            //                () => true,
            //                (why) => false);
            //        })
            //    .WhenAllAsync();
            //return onSuccess();
        }