public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous,
                                                                        "post", Route = null)] HttpRequestMessage req,
                                                           TraceWriter log)
        {
            log.Info($"WebHook Function called at: { DateTime.Now }");

            // WebHook Registration
            string validationToken = WHHelpRoutines.GetValidationToken(req, log);

            if (validationToken != null)
            {
                return(WHHelpRoutines.RegisterWebHook(req, validationToken, log));
            }
            else
            {
                log.Info($"---- Registration: Registering WebHook already done");
            }

            // Changes
            var myContent = await req.Content.ReadAsStringAsync();

            var allNotifications = JsonConvert.DeserializeObject <ResponseModel <NotificationModel> >(myContent).Value;

            if (allNotifications.Count > 0)
            {
                foreach (var oneNotification in allNotifications)
                {
                    // Login in SharePoint
                    string        baseUrl         = ConfigurationManager.AppSettings["whSpBaseUrl"];
                    ClientContext SPClientContext = WHHelpRoutines.LoginSharePoint(baseUrl, log);

                    // Get the Changes
                    GetChanges(SPClientContext, oneNotification.Resource, log);
                }
            }

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
        static void GetChanges(ClientContext SPClientContext, string ListId, TraceWriter log)
        {
            // Get the List where the WebHook is working
            List myListWebHook = WHHelpRoutines.GetListWebHook(SPClientContext, log);

            // Get the Change Query
            ChangeQuery myChangeQuery = WHHelpRoutines.GetChangeQueryNew(ListId, log); // Only new items and for the last one minute

            // Get all the Changes
            ChangeCollection allChanges = WHHelpRoutines.GetAllChanges(myListWebHook, myChangeQuery, SPClientContext, log);

            foreach (Change oneChange in allChanges)
            {
                if (oneChange is ChangeItem)
                {
                    // Get what is changed
                    ListItem itemChanged = WHHelpRoutines.GetItemChanged(myListWebHook, oneChange, SPClientContext, log);
                    log.Info($"itemChangedID - " + itemChanged.Id.ToString());

                    // Do something with the Item Changed
                    DoSomething(SPClientContext, itemChanged, log);
                }
            }
        }