public static string InsertProfileInfo(ProfileInfo pi)
        {
            CredentialAttempt ca = new CredentialAttempt();
            //Need to created ETicket???????
            ca.ETicket = Guid.NewGuid().ToString();
            ca.ProfileInfo = pi;
            TimeStamps ts = new TimeStamps(){Initiated = DateTime.UtcNow};
            ca.TimeStamps = ts;

            var newprofileinfo = BadgeApiDB.GetCollection("CredentialAttempt");
            try
            {
                newprofileinfo.Insert(ca);
            }
            catch (Exception ex)
            {
                // To do find the result and return????
            }

            return ca.ToJson();
        }
        public static string UpdateCredentialAttemptResult(CredentialAttempt ca)
        {
            var collection = BadgeApiDB.GetCollection<CredentialAttempt>("CredentialAttempt");
            var query = Query.EQ("ETicket", ca.ETicket);
            var result = collection.FindOne(query);

            if (result != null)
            {
                var update = Update<CredentialAttempt>.Set(e => e.Result, ca.Result); // update modifiers
                update.Set(e => e.TimeStamps.ResultReceived, DateTime.UtcNow);
                collection.Update(query, update);
                return result.ToJson();
            }
            else
            {
                //CredentialAttempt ca = new CredentialAttempt();
                //Need to created ETicket???????
                ca.ETicket = ca.ETicket;
                TimeStamps ts = new TimeStamps() { Initiated = DateTime.UtcNow, ResultReceived = DateTime.UtcNow };
                ca.TimeStamps = ts;

                var newprofileinfo = BadgeApiDB.GetCollection("CredentialAttempt");
                newprofileinfo.Insert(ca);
                return ca.ToJson();
            }
        }