public static void AnswerQuizQuestion(string quizid = "", string answerid = "", string answerGiven = "", string answerResult = "")
    {
        if (answeredQuestions == null)
        {
            answeredQuestions = new List <AnswerQuizQuestion>();
        }

        MetricEvent        newEvent   = new MetricEvent();
        AnswerQuizQuestion metricData = new AnswerQuizQuestion(answerid, answerGiven, answerResult);

        newEvent.SetEventInfo(uuid, user, sessionID, null);

        newEvent.Timestamp(DateTime.UtcNow);
        newEvent.Data(metricData);

        //Keep a tally of the events in a session in the case of time race conditions to still know which event occured first
        newEvent.SessionIndex(sessionMetricList.Count);



        answeredQuestions.Add(metricData);

        if (isSending == true)
        {
            APIManager.SubmitMetrics((new MetricEvent[1] {
                newEvent
            }), (res) => HandleResponse(res));
        }
        sessioncount++;
    }
    public static void QuizEnd(string quizid = "", string quizResult = "")
    {
        if (answeredQuestions == null)
        {
            answeredQuestions = new List <AnswerQuizQuestion>();
        }

        MetricEvent newEvent   = new MetricEvent();
        QuizEnd     metricData = new QuizEnd(quizid, quizResult, answeredQuestions, DateTime.Now.Subtract(lastActionTime).TotalSeconds);

        newEvent.SetEventInfo(uuid, user, sessionID, null);

        newEvent.Timestamp(DateTime.UtcNow);
        newEvent.Data(metricData);

        //Keep a tally of the events in a session in the case of time race conditions to still know which event occured first
        newEvent.SessionIndex(sessionMetricList.Count);

        sessionMetricList.Add(newEvent);

        APIManager.SubmitMetrics((new MetricEvent[1] {
            newEvent
        }), (res) => HandleResponse(res));
        sessioncount++;
    }
    public static void GenericEvent(string actionid = "", string data = "")
    {
        if (sessionMetricList == null)
        {
            sessionMetricList = new List <MetricEvent>();
        }

        MetricEvent newEvent = new MetricEvent();

        newEvent.SetEventInfo(uuid, user, sessionID, null);
        GenericEvent metricData = new GenericEvent(actionid, data);

        newEvent.Timestamp(DateTime.UtcNow);
        newEvent.Data(metricData);

        //Keep a tally of the events in a session in the case of time race conditions to still know which event occured first
        newEvent.SessionIndex(sessionMetricList.Count);


        //add it to the list of events this session
        sessionMetricList.Add(newEvent);
        //set the last action to have the duration easily accesible for the event end
        lastActionTime = newEvent.Timestamp();

        //TODO: attempt to upload to database
        //if fail then save

        APIManager.SubmitMetrics((new MetricEvent[1] {
            newEvent
        }), (res) => HandleResponse(res));
        sessioncount++;
    }
    public static void ActivityStart(string activityid = "")
    {
        MetricEvent   newEvent   = new MetricEvent();
        ActivityStart metricData = new ActivityStart(activityid);

        newEvent.SetEventInfo(uuid, user, sessionID, null);

        newEvent.Timestamp(DateTime.UtcNow);
        newEvent.Data(metricData);

        //Keep a tally of the events in a session in the case of time race conditions to still know which event occured first
        newEvent.SessionIndex(sessionMetricList.Count);

        APIManager.SubmitMetrics((new MetricEvent[1] {
            newEvent
        }), (res) => HandleResponse(res));
        sessioncount++;
    }
    public static void GainBadge(string badgeid = "", string newteam = "", string newawardedby = "")
    {
        MetricEvent newEvent   = new MetricEvent();
        GainBadge   metricData = new GainBadge(badgeid, newteam, newawardedby);

        newEvent.SetEventInfo(uuid, user, sessionID, null);

        newEvent.Timestamp(DateTime.UtcNow);
        newEvent.Data(metricData);

        //Keep a tally of the events in a session in the case of time race conditions to still know which event occured first
        newEvent.SessionIndex(sessionMetricList.Count);


        APIManager.SubmitMetrics((new MetricEvent[1] {
            newEvent
        }), (res) => HandleResponse(res));
        sessioncount++;
    }
    public static void LeaveCourse(string courseid = "", string result = "", string awards = "", float progress = 0.0f)
    {
        MetricEvent newEvent   = new MetricEvent();
        LeaveCourse metricData = new LeaveCourse(courseid, result, awards, progress);

        newEvent.SetEventInfo(uuid, user, sessionID, null);

        newEvent.Timestamp(DateTime.UtcNow);
        newEvent.Data(metricData);

        //Keep a tally of the events in a session in the case of time race conditions to still know which event occured first
        newEvent.SessionIndex(sessionMetricList.Count);


        APIManager.SubmitMetrics((new MetricEvent[1] {
            newEvent
        }), (res) => HandleResponse(res));
        sessioncount++;
    }
    //have the id be optional so the event can be logged even in there is unknown information
    public static void QuizStart(string quizid = "")
    {
        if (sessionMetricList == null)
        {
            sessionMetricList = new List <MetricEvent>();
        }
        if (answeredQuestions == null)
        {
            answeredQuestions = new List <AnswerQuizQuestion>();
        }
        else
        {
            //clear any questions from a previous quiz
            answeredQuestions.Clear();
        }


        MetricEvent newEvent = new MetricEvent();

        //newEvent.SetEventInfo("FFFFFFFFF", user, "12ss", null);
        newEvent.SetEventInfo(uuid, user, sessionID, null);
        QuizStart metricData = new QuizStart(quizid);

        newEvent.Timestamp(DateTime.UtcNow);
        newEvent.Data(metricData);

        //Keep a tally of the events in a session in the case of time race conditions to still know which event occured first
        newEvent.SessionIndex(sessionMetricList.Count);


        //add it to the list of events this session
        sessionMetricList.Add(newEvent);
        //set the last action to have the duration easily accesible for the event end
        lastActionTime = newEvent.Timestamp();

        //TODO: attempt to upload to database
        //if fail then save

        APIManager.SubmitMetrics((new MetricEvent[1] {
            newEvent
        }), (res) => HandleResponse(res));
        sessioncount++;
    }
    public static void AnswerInstructorQuestion(string courseid = "", string instructorid = "", string questionid = "", string answer = "", string result = "")
    {
        MetricEvent newEvent = new MetricEvent();
        AnswerInstructorQuestion metricData = new AnswerInstructorQuestion(courseid, instructorid, questionid, answer, result);

        newEvent.SetEventInfo(uuid, user, sessionID, null);

        newEvent.Timestamp(DateTime.UtcNow);
        newEvent.Data(metricData);

        //Keep a tally of the events in a session in the case of time race conditions to still know which event occured first
        newEvent.SessionIndex(sessionMetricList.Count);
        if (isSending == true)
        {
            APIManager.SubmitMetrics((new MetricEvent[1] {
                newEvent
            }), (res) => HandleResponse(res));
        }
        sessioncount++;
    }
    public static void ActivityEnd(string activityid = "", string result = "")
    {
        double duration = DateTime.Now.Subtract(lastActionTime).TotalSeconds;

        MetricEvent newEvent   = new MetricEvent();
        ActivityEnd metricData = new ActivityEnd(activityid, result, Math.Abs(duration));

        newEvent.SetEventInfo(uuid, user, sessionID, null);

        newEvent.Timestamp(DateTime.UtcNow);
        newEvent.Data(metricData);

        //Keep a tally of the events in a session in the case of time race conditions to still know which event occured first
        newEvent.SessionIndex(sessionMetricList.Count);

        APIManager.SubmitMetrics((new MetricEvent[1] {
            newEvent
        }), (res) => HandleResponse(res));
        sessioncount++;
    }