public async Task <bool> UnsubscribeAccountFromWebhooks(string environment, string userId)
        {
            var userCredentials = await CredentialsRetriever.GetUserCredentials(userId);

            var result = await Webhooks.RemoveAllAccountSubscriptionsAsync(environment, userCredentials);

            return(result);
        }
        public async Task <bool> SubscribeAccountToWebhook(string environment, string userId)
        {
            var userCredentials = await CredentialsRetriever.GetUserCredentials(userId);

            var success = await Webhooks.SubscribeToAccountActivityEventsAsync(environment, userCredentials);

            return(success);
        }
        public async Task <bool> DeleteWebhook(string environment, string webhookId, string userId)
        {
            var userCredentials = await CredentialsRetriever.GetUserCredentials(userId);

            var result = await Webhooks.RemoveWebhookAsync(environment, webhookId, userCredentials);

            return(result);
        }
        public async Task <bool> RegisterWebhook(string environment, string url, string userId)
        {
            url = "https://36716537.ngrok.io/account_activity";
            var userCredentials = await CredentialsRetriever.GetUserCredentials(userId);

            var result = await Webhooks.RegisterWebhookAsync(environment, url, userCredentials);

            if (result == null)
            {
                return(false);
            }

            // Register webhook in server
            var webhookEnvironment = Startup.WebhookConfiguration.RegisteredWebhookEnvironments.FirstOrDefault(x =>
                                                                                                               x.Name == environment);

            webhookEnvironment?.AddWebhook(result);

            return(true);
        }
        public async Task <string> SubscribeToAccountActivities(string environment, string userId)
        {
            var userCredentials = await CredentialsRetriever.GetUserCredentials(userId);

            var webhook = Startup.WebhookConfiguration.RegisteredWebhookEnvironments.FirstOrDefault(x => x.Name == environment);

            if (webhook == null)
            {
                return("ENVIRONMENT_NOT_REGISTERED");
            }

            var activityStream = Stream.CreateAccountActivityStream(userId);

            Startup.WebhookConfiguration.AddActivityStream(activityStream);

            activityStream.TweetFavourited += (sender, args) =>
            {
                Console.WriteLine($"{userId} favourited tweet!");
            };

            return("SUBSCRIBED_ON_SERVER");
        }
        public async Task <bool> ChallengeWebhook(string environment, string webhookId, string userId)
        {
            var userCredentials = await CredentialsRetriever.GetUserCredentials(userId);

            return(await Webhooks.ChallengeWebhookAsync(environment, webhookId, userCredentials));
        }