public bool Validate(byte[] imagebyte, string url)
                    {
                        try
                        {
                            string data    = Convert.ToBase64String(imagebyte);
                            var    client  = new RestClient(RealFakeUrl);
                            var    request = new RestRequest(Method.POST);
                            request.AddHeader("Content-Type", "application/json");
                            request.AddParameter("undefined", "{\"Binary\":\"" + data + "\"} ", ParameterType.RequestBody);
                            IRestResponse response = client.Execute(request);

                            dynamic obj           = JObject.Parse(response.Content);
                            var     result_string = obj.Result.ToString();

                            JArray a = JArray.Parse(result_string);

                            var     value = a[0].ToString();
                            dynamic obj1  = JObject.Parse(value);

                            if (obj1.TagName == "Real")
                            {
                                alt.Add("Real/Fake", "Pass", url);
                                return(true);
                            }
                            alt.Add("Real/Fake", "Fail", url);
                            return(false);
                        }
                        catch (Exception e)
                        {
                            error = e.Message;
                            return(false);
                        }
                    }
                    public bool Validate(string url, byte[] imageBytes, string gesture)
                    {
                        string tagname = "";

                        try
                        {
                            //Gesture API Call
                            var client1  = new RestClient(GestureAPIEndpoint + "/customvision/v3.0/Prediction/" + GestureProjectID + "/detect/iterations/" + GestureIteration + "/image");
                            var request1 = new RestRequest(Method.POST);
                            request1.AddHeader("cache-control", "no-cache");
                            request1.AddHeader("Content-Type", "application/octet-stream");
                            request1.AddHeader("Prediction-Key", GestureAPIKey);
                            request1.AddParameter("data", imageBytes, ParameterType.RequestBody);
                            IRestResponse response1 = client1.Execute(request1);

                            var result = response1.Content;

                            dynamic objjsn = JObject.Parse(result);
                            var     jsnar  = objjsn.predictions.ToString();
                            JArray  ar     = JArray.Parse(jsnar);
                            int     max    = 0;
                            for (int i = 0; i < ar.Count; i++)
                            {
                                dynamic pred = JObject.Parse(ar[i].ToString());
                                int     prob = pred.probability * 100;

                                if (prob > max)
                                {
                                    max     = prob;
                                    tagname = pred.tagName;
                                }
                            }

                            if (tagname == gesture)
                            {
                                alt.Add("Random Gesture", "Pass", url);
                                return(true);
                            }

                            alt.Add("Random Gesture", "Fail", url);
                            return(false);
                        }
                        catch (Exception e)
                        {
                            error = e.Message;
                            return(false);
                        }
                    }
                    public string Validate(string url, byte[] imagebytes, bool face, bool multiple_face, bool sunglasses, bool emotions)
                    {
                        try
                        {
                            //API CAll
                            var apiresponse = FaceAPICall(imagebytes);

                            //DB check
                            AuditLoggerTable alt = new AuditLoggerTable();

                            bool isface = true, ismultipleface = true, issunglasses = true, isemotions = true;

                            if (apiresponse.Length == 2)
                            {
                                isface = false;
                            }

                            if (apiresponse.Length > 2)
                            {
                                JArray items = JArray.Parse(apiresponse);

                                for (int i = 0; i < items.Count; i++)
                                {
                                    var item    = (JObject)items[i];
                                    var itemres = item["faceAttributes"]["glasses"];

                                    if (itemres.ToString() == "Sunglasses")
                                    {
                                        issunglasses = false;
                                    }
                                }
                            }

                            if (apiresponse.Length > 2)
                            {
                                JArray items  = JArray.Parse(apiresponse);
                                int    length = items.Count;

                                if (length > 1)
                                {
                                    ismultipleface = false;
                                }
                            }

                            if (apiresponse.Length > 2)
                            {
                                JArray items = JArray.Parse(apiresponse);

                                for (int i = 0; i < items.Count; i++)
                                {
                                    var item     = (JObject)items[i];
                                    var anger    = item["faceAttributes"]["emotion"]["anger"];
                                    var sadness  = item["faceAttributes"]["emotion"]["sadness"];
                                    var surprise = item["faceAttributes"]["emotion"]["surprise"];

                                    if ((float)anger > 0.1 || (float)sadness > 0.1 || (float)surprise > 0.1)
                                    {
                                        isemotions = false;
                                    }
                                }
                            }



                            if (face)
                            {
                                //Check with API Call Result
                                if (isface)
                                {
                                    alt.Add("Face Availability", "Pass", url);
                                }
                                else
                                {
                                    alt.Add("Face Availability", "Fail", url);
                                    return("Face Not Found");
                                }
                            }


                            //DB check
                            if (multiple_face)
                            {
                                //Check with API Call Result
                                if (ismultipleface)
                                {
                                    alt.Add("Multiple Face", "Pass", url);
                                }
                                else
                                {
                                    alt.Add("Multiple Face", "Fail", url);
                                    return("Multiple Faces are not allowed");
                                }
                            }


                            //DB check
                            if (sunglasses)
                            {
                                //Check with API Call Result
                                if (issunglasses)
                                {
                                    alt.Add("Sunglasses", "Pass", url);
                                }
                                else
                                {
                                    alt.Add("Sunglasses", "Fail", url);
                                    return("Please remove the sunglasses");
                                }
                            }

                            //DB check
                            if (emotions)
                            {
                                //Check with API Call Result
                                if (isemotions)
                                {
                                    alt.Add("Emotions", "Pass", url);
                                }
                                else
                                {
                                    alt.Add("Emotions", "Fail", url);
                                    return("Your expression must be Neutral");
                                }
                            }

                            //Success Enum
                            return("0");
                        }
                        catch (Exception e)
                        {
                            error = e.Message;
                            return("");
                        }
                    }