private IEnumerator RunRoutine()
        {
            UnityWebRequest request = Postman.CreateGetRequest(Endpoints.instance.GOOGLE_CALENDAR(gmailAddress, numberOfEvents, apiKey));

            yield return(request.SendWebRequest());

            json = JSON.Parse(request.downloadHandler.text);

            bool ok = request.error == null ? true : false;

            if (!ok)
            {
                WidgetLogger.instance.Log(this, "Error: " + request.error);
                yield break;
            }

            // Remove old events
            foreach (Transform child in scrollParent)
            {
                Destroy(child.gameObject);
            }

            for (int i = 0; i < json["events"].Count; i++)
            {
                JSONNode item      = json["events"][i];
                DateTime startDate = DateTime.Parse(item["start"]);
                DateTime endDate   = DateTime.Parse(item["end"]);

                GoogleCalendarEvent eventEntry = Instantiate(googleCalendarEventPrefab, scrollParent).GetComponent <GoogleCalendarEvent>();
                eventEntry.SetDescription(item["description"]);
                eventEntry.SetEndDateText(endDate.ToString("dd MMM"));
                eventEntry.SetEndTime(item["endTime"]);
                eventEntry.SetGoogleCalendar(this);
                eventEntry.SetLocation(item["location"]);
                eventEntry.SetStartDateText(startDate.ToString("dd MMM"));
                eventEntry.SetStartDateTextColour(GetTextColour());
                eventEntry.SetStartTime(item["startTime"]);
                eventEntry.SetSummaryText(item["summary"]);
                eventEntry.SetSummaryTextColour(GetTextColour());
            }

            scrollbarBackground.color = Colours.Darken(GetWidgetColour());
            scrollbarHandle.color     = Colours.Lighten(GetWidgetColour(), 0.1f);
        }
 protected void insertEventsButton_Click(object sender, EventArgs e)
 {
     Label insertEventsLabel = new Label();
     if (idTextBox.Text == "" || summaryTextBox.Text == "" || descriptionTextBox.Text == "" || startTextBox.Text == "" || endTextBox.Text == "")
     {
         insertEventsLabel.Text = "You have to enter data";
     }
     else
     {
         string calendarId = idTextBox.Text;
         string method = "insert";
         string type = "events";
         string token_type = Convert.ToString(Session["token_type"]);
         string access_token = Convert.ToString(Session["access_token"]);
         GoogleCalendarEvent actEvent = new GoogleCalendarEvent
         {
             summary = summaryTextBox.Text,
             description = descriptionTextBox.Text,
             start = new GoogleCalendarEventTime(Convert.ToDateTime(startTextBox.Text)),
             end = new GoogleCalendarEventTime(Convert.ToDateTime(endTextBox.Text))
         };
         ASCIIEncoding encoding = new ASCIIEncoding();
         string data = JsonConvert.SerializeObject(actEvent);
         Dictionary<string, string> parameters = new Dictionary<string, string>();
         parameters.Add("calendarId", calendarId);
         googleCalendarAPI calendarAPI = new googleCalendarAPI(method, type, parameters, data, token_type, access_token);
         string result = calendarAPI.json;
         if (result.Equals("error"))
         {
             insertEventsLabel.Text = "error";
             insertEvents.Controls.Add(insertEventsLabel);
             return;
         }
         insertEventsLabel.Text = "You already insert envent";
     }
     insertEvents.Controls.Add(insertEventsLabel);
 }