@Override
    public void actionPerformed(ActionEvent e) {
        try {
            conn = DriverManager.getConnection(Utils.DB_URL);
            PreparedStatement checkStatMotherlang = conn.prepareStatement("select motherlang_word from word where motherlang_word = ?");
            PreparedStatement checkStatForeignLang = conn.prepareStatement("select foreignlang_word from word where foreignlang_word = ?");
            checkStatMotherlang.setString(1, motherLangTextField.getText());
            checkStatForeignLang.setString(1, translateTextField.getText());
            resSetMotherlang = checkStatMotherlang.executeQuery();
            resSetTranslation = checkStatForeignLang.executeQuery();
            PreparedStatement getSectionId = conn.prepareStatement("select id from section where name = ?");
            getSectionId.setString(1, AddCard.getSelectedSection());
            sectionResSet = getSectionId.executeQuery();
            if (!resSetMotherlang.next() && !resSetTranslation.next()) {
                if (Utils.checkEnteredTextForLetters(motherLangTextField.getText()) && motherLangTextField.getText().length()>0
                        && Utils.checkEnteredTextForLetters(translateTextField.getText()) && translateTextField.getText().length()>0) {
                    PreparedStatement pst = conn.prepareStatement("insert into word (motherlang_word, foreignlang_word, section_id) values (?, ?, ?)");
                    pst.setString(1, motherLangTextField.getText());
                    pst.setString(2, translateTextField.getText());
                    pst.setInt(3, sectionResSet.getInt("id"));
                    pst.execute();
                    statusLbl.setText("New card added succesfully");
                    motherLangTextField.setText("");
                    translateTextField.setText("");
                    pst.close();
                }
                else {
                    statusLbl.setText("You can use only letters to type words");
                }
            }
            else {
                statusLbl.setText("Such words are already in DB");
            }
        } catch (SQLException e1) {
            e1.printStackTrace();
        }
        finally {
            try {
                conn.close();
            } catch (SQLException e1) {
                e1.printStackTrace();
            }
        }

    }