private ScryfallCard FetchRandomCard()
        {
            ScryfallCard card;

            try
            {
                System.Threading.Thread.Sleep(100);
                string responseContent       = string.Empty;
                HttpResponseMessage response = client.GetAsync("cards/random").Result;
                response.EnsureSuccessStatusCode();
                responseContent = response.Content.ReadAsStringAsync().Result;

                card = ScryfallCard.FromJson(responseContent);

                SqlCeCommand     cmd    = new SqlCeCommand("SELECT * FROM CARD WHERE [id] like \'" + card.id + "\'", db.connection);
                SqlCeDataAdapter da     = new SqlCeDataAdapter(cmd);
                DataTable        result = new DataTable();
                da.Fill(result);

                if (result.Rows.Count == 0)
                {
                    card.SaveToDB(db);
                }
            }
            catch (Exception ex)
            {
                throw;
            }


            return(card);
        }
        public ScryfallCard FetchCardByID(string text)
        {
            System.Threading.Thread.Sleep(100);
            ScryfallCard        retval = new ScryfallCard();
            HttpResponseMessage response;
            string responseContent = string.Empty;

            response = client.GetAsync("cards/" + text).Result;
            response.EnsureSuccessStatusCode();
            responseContent = response.Content.ReadAsStringAsync().Result;

            retval = ScryfallCard.FromJson(responseContent);

            return(retval);
        }
        private ScryfallCard FetchNamedCardExact(string text)
        {
            ScryfallCard retval = null;

            try
            {
                System.Threading.Thread.Sleep(100);
                string responseContent = string.Empty;
                HttpResponseMessage response;

                SqlCeCommand     cmd    = new SqlCeCommand("SELECT * FROM CARD WHERE name = \'" + text.Replace("\'", "\'\'") + "\'", db.connection);
                SqlCeDataAdapter da     = new SqlCeDataAdapter(cmd);
                DataTable        result = new DataTable();
                da.Fill(result);
                if (result.Rows.Count > 1)
                {
                    Console.WriteLine(String.Format("Card {0} has more than one record!!!", text));
                }
                else if (result.Rows.Count != 0)
                {
                    Console.WriteLine(String.Format("card {0} exists in DB", text));
                    //retval = ScryfallCard.LoadFromDB(result.Rows[0]);
                    retval = ScryfallCard.LoadCardFromDatarow(result.Rows[0]);
                }
                else
                {
                    response = client.GetAsync("cards/named?exact=" + text).Result;
                    response.EnsureSuccessStatusCode();
                    responseContent = response.Content.ReadAsStringAsync().Result;

                    retval = ScryfallCard.FromJson(responseContent);

                    retval.SaveToDB(db);
                }
            }
            catch (Exception ex)
            {
                retval = null;
                throw;
            }


            return(retval);
        }