/// <summary>
        /// Generates the Json string required for certain API calls.
        /// </summary>
        /// <param name="fieldConfigList">a list of configurations</param>
        /// <returns></returns>
        public static string GenerateFieldsJson(List <Tuple <string, FieldTypes, string> > fieldConfigList)
        {
            if (fieldConfigList == null)
            {
                throw new ArgumentNullException("Field Config List cannot be null");
            }

            StringBuilder json = new StringBuilder();

            json.Append("{\"fields\":{");
            int extraCommaIndex = json.Length;

            if (fieldConfigList.Count > 0)
            {
                foreach (Tuple <string, FieldTypes, string> fieldConfig in fieldConfigList)
                {
                    if (fieldConfig.Item1 == null || fieldConfig.Item3 == null)
                    {
                        throw new ArgumentException("Field Config Values cannot be null");
                    }
                    json.Append(",\"");
                    json.Append(fieldConfig.Item1);
                    json.Append("\":{\"");
                    json.Append(FieldTypesClass.GetString(fieldConfig.Item2));
                    json.Append("\":\"");
                    json.Append(fieldConfig.Item3);
                    json.Append("\"}");
                }
                json.Remove(extraCommaIndex, 1);
            }
            json.Append("}}");
            return(json.ToString());
        }
        /// <summary>
        /// Runs a query against the database.
        ///
        /// This is used to perform a basic filter before returning results from the Database.
        ///
        /// This can be expanded similar to the method using GenerateFieldJson to allow for more than one filtering condition.
        /// </summary>
        /// <param name="collectionID">the ID of the collection to query</param>
        /// <param name="fieldName">the field to filter by</param>
        /// <param name="fieldValue">the required value of the field</param>
        /// <returns>the Json string response from the Database</returns>
        private static string RunQuery(string collectionID, string fieldName, string fieldValue)
        {
            string structuredQuery = "{\"structuredQuery\":{\"where\":{\"fieldFilter\":{\"field\":{\"fieldPath\":\""
                                     + fieldName + "\"},\"op\":\"EQUAL\",\"value\":{\""
                                     + FieldTypesClass.GetString(FieldTypes.StringValue) + "\":\""
                                     + fieldValue + "\"}}},\"from\":[{\"collectionId\":\""
                                     + collectionID + "\"}]}}";
            string path = ":runQuery";

            return(WebClient.UploadString(path, structuredQuery));
        }