private void RetrieveSnortData(List <RaspberryPi> allRaspberryPis)
    {
        var request = new ScanRequest
        {
            TableName = "Snort",
        };

        client.ScanAsync(request, (result) => {
            allSnortData = new List <SnortData>();
            foreach (var item in result.Response.Items)
            {
                SnortData snortData = new SnortData();

                foreach (var kvp in item)
                {
                    string attributeName = kvp.Key;
                    AttributeValue value = kvp.Value;
                    if (attributeName == "sensor")
                    {
                        snortData.sensor = value.S;
                    }
                    else if (attributeName == "order")
                    {
                        snortData.order = value.S;
                    }
                    else if (attributeName == "alert")
                    {
                        snortData.alert = value.S;
                    }
                    else if (attributeName == "alertPriority")
                    {
                        snortData.alertPriority = value.S;
                    }
                    else if (attributeName == "eventTimeStamp")
                    {
                        snortData.eventTimeStamp = value.S;
                    }
                }
                allSnortData.Add(snortData);
            }
            Debug.Log(allSnortData.Count);
            SpawnSensorTags(allRaspberryPis);
        });
    }
    public void updateSystemColor()
    {
        SnortData oldSnort = new SnortData();

        oldSnort.eventTimeStamp = allSnortData [0].eventTimeStamp;

        var request = new ScanRequest
        {
            TableName = "Snort",
        };

        client.ScanAsync(request, (result) => {
            allSnortData = new List <SnortData>();
            foreach (var item in result.Response.Items)
            {
                SnortData snortData = new SnortData();

                foreach (var kvp in item)
                {
                    string attributeName = kvp.Key;
                    AttributeValue value = kvp.Value;
                    if (attributeName == "sensor")
                    {
                        snortData.sensor = value.S;
                    }
                    else if (attributeName == "order")
                    {
                        snortData.order = value.S;
                    }
                    else if (attributeName == "alert")
                    {
                        snortData.alert = value.S;
                    }
                    else if (attributeName == "alertPriority")
                    {
                        snortData.alertPriority = value.S;
                    }
                    else if (attributeName == "eventTimeStamp")
                    {
                        snortData.eventTimeStamp = value.S;
                    }
                }
                allSnortData.Add(snortData);
            }
            if (oldSnort.eventTimeStamp == allSnortData[0].eventTimeStamp)
            {
                if (timer < 0)
                {
                    _Rpi.GetComponent <Renderer> ().material.color = Color.green;
                    foreach (GameObject sensorTag in sensorTags)
                    {
                        //sensorTag.GetComponent<Renderer> ().material.color = Color.green;
                        sensorTag.GetComponent <Renderer> ().material.color = Color.green;
                    }
                    timer      = 90.0f;
                    startTimer = false;
                    _Rpi.transform.GetChild(0).GetChild(1).GetComponentInChildren <Text> ().text = "System is safe";
                }
                //_Rpi.GetComponent<Renderer> ().material.color = Color.green;

                /*_Rpi.GetComponent<Renderer> ().material.color = currentColor;
                 * foreach(GameObject sensorTag in sensorTags){
                 *      //sensorTag.GetComponent<Renderer> ().material.color = Color.green;
                 *      sensorTag.GetComponent<Renderer> ().material.color = currentColor;
                 * }*/
            }
            else if (allSnortData[0].alertPriority == "4")
            {
                _Rpi.GetComponent <Renderer> ().material.color = Color.green;
                foreach (GameObject sensorTag in sensorTags)
                {
                    sensorTag.GetComponent <Renderer> ().material.color = Color.green;
                }
                currentColor = Color.green;
                _Rpi.transform.GetChild(0).GetChild(1).GetComponentInChildren <Text> ().text = allSnortData[0].alert;
                timer      = 90.0f;
                startTimer = true;
            }
            else if (allSnortData[0].alertPriority == "3")
            {
                _Rpi.GetComponent <Renderer> ().material.color = Color.yellow;
                foreach (GameObject sensorTag in sensorTags)
                {
                    sensorTag.GetComponent <Renderer> ().material.color = Color.yellow;
                }
                currentColor = Color.yellow;
                _Rpi.transform.GetChild(0).GetChild(1).GetComponentInChildren <Text> ().text = allSnortData[0].alert;
                timer      = 90.0f;
                startTimer = true;
            }
            else if (allSnortData[0].alertPriority == "2")
            {
                _Rpi.GetComponent <Renderer> ().material.color = Color.red;
                foreach (GameObject sensorTag in sensorTags)
                {
                    sensorTag.GetComponent <Renderer> ().material.color = Color.red;
                }
                currentColor = Color.red;
                _Rpi.transform.GetChild(0).GetChild(1).GetComponentInChildren <Text> ().text = allSnortData[0].alert;
                timer      = 90.0f;
                startTimer = true;
            }
            else
            {
                _Rpi.GetComponent <Renderer> ().material.color = Color.black;
                foreach (GameObject sensorTag in sensorTags)
                {
                    sensorTag.GetComponent <Renderer> ().material.color = Color.black;
                }
                currentColor = Color.black;
                _Rpi.transform.GetChild(0).GetChild(1).GetComponentInChildren <Text> ().text = allSnortData[0].alert;
                timer      = 90.0f;
                startTimer = true;
            }
        });
    }