public int InsertTranslationHistory(int source, int target, string textToTranslate, string translatedText, string notes, int textToTranslateID)
        {
            try
            {
                connection = new SQLiteConnection(dbPath, false);

                if (textToTranslateID == 0)
                {
                    var TextToTranslate = new TextToTranslate()
                    {
                        Text1 = textToTranslate
                    };
                    connection.Insert(TextToTranslate);
                    textToTranslateID = TextToTranslate.TextToTranslateID;
                }

                var TranslatedText = new TranslatedText()
                {
                    Text2 = translatedText
                };
                connection.Insert(TranslatedText);
                var TranslatedTextID = TranslatedText.TranslatedTextID;

                var translationHistory = new TextTranslation()
                {
                    Source          = source,
                    Target          = target,
                    TextToTranslate = textToTranslateID,
                    TranslatedText  = TranslatedTextID,
                    DateCreated     = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"),
                    Notes           = notes
                };

                var translationHistoryID = connection.Insert(translationHistory);

                if (translationHistoryID < 1)
                {
                    Logger.Log("Could not insert History in DB");
                }

                return(translationHistory.ID);
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
            }
            finally
            {
                connection.Close();
            }
            return(1);
        }
        public void AddDetectedTextToImage(int ImageID, string DetectedText)
        {
            try
            {
                var    TextDetected = 0;
                string query;
                connection = new SQLiteConnection(dbPath, false);

                if (!String.IsNullOrEmpty(DetectedText))
                {
                    TextDetected = 1;

                    //Add Detected text into TextToTranslate
                    TextToTranslate dText = new TextToTranslate();
                    dText.Text1 = DetectedText;

                    connection.Insert(dText);

                    query = "UPDATE CapturedImages SET TextDetected = " + TextDetected + ", TextToTransID = " + dText.TextToTranslateID + ", DateTextDetected = '" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "' WHERE CapturedImagesID = " + ImageID;
                }
                else
                {
                    query = "UPDATE CapturedImages SET TextDetected = " + TextDetected + ", DateTextDetected = '" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "' WHERE CapturedImagesID = " + ImageID;
                }

                int result = connection.Execute(query);

                if (result != 1)
                {
                    Logger.Log("Could not Add detected Text to Image with ID " + ImageID);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
            }
            finally
            {
                connection.Close();
            }
        }