private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        NanoPost np;

        byte[] parentHash = EncryptionProvider.EMPTY_HASH_SHA256;
        String parentHashStr = edParentHash.getText();
        if (!parentHashStr.trim().isEmpty()) {
            if ((parentHashStr.length() == EncryptionProvider.SHA_256_HASH_SIZE_BYTES * 2) && parentHashStr.matches("[a-f0-9]+")) {
                parentHash = ByteUtils.stringToBytes(parentHashStr);
            }
        }

        if (!edAttachFile.getText().isEmpty()) {
            File attachFile = new File(edAttachFile.getText());
            if (!attachFile.exists()) {
                JOptionPane.showMessageDialog(this, "Selected attach file does not exist", "Error", JOptionPane.ERROR_MESSAGE);
                return;
            }

            np = NanoPostFactory.createNanoPost(txtPostText.getText(), parentHash, attachFile);
        } else {
            np = NanoPostFactory.createNanoPost(txtPostText.getText(), parentHash, null);
        }

        File containerFile;
        if (rbRandomContainer.isSelected()) {
            containerFile = this.getRandomContainerPNG();

            if (containerFile == null) {
                JOptionPane.showMessageDialog(this, "There is no any PNG file in folder " + MainClass.CONTAINERS_DIR, "Error", JOptionPane.ERROR_MESSAGE);
                return;
            }
        } else {
            containerFile = new File(edContainerFile.getText());
        }

        if (!containerFile.exists()) {
            JOptionPane.showMessageDialog(this, "Selected container file does not exists.", "Error", JOptionPane.ERROR_MESSAGE);
            return;
        }

        File outputFile = null;
        NanoPost nanoPost = null;

        try {
            outputFile = new File(MainClass.OUTBOX_DIR + System.getProperty("file.separator") + System.currentTimeMillis() + ".png");
            ImageUtils.encodeIntoImage(containerFile, outputFile, np.getAsBytes(), edBoardCode.getText());

            byte[] dataBytes = ImageUtils.tryToDecodeSteganoImage(ByteUtils.readBytesFromFile(outputFile), edBoardCode.getText());

            nanoPost = NanoPostFactory.getNanoPostFromBytes(dataBytes, true);
            nanoPost.setSourceImageData(ByteUtils.readBytesFromFile(outputFile));
            nanoPost.saveToFile(true);
            nanoPost.clearAllBinaryData();

            // Trying to free memory
            nanoPost = null;
            dataBytes = null;
        } catch (MalformedNanoPostException | IOException | NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | InvalidAlgorithmParameterException | IllegalBlockSizeException | BadPaddingException ex) {
            JOptionPane.showMessageDialog(null, ex.getLocalizedMessage(), "An error occured", JOptionPane.ERROR_MESSAGE);
        } finally {
            outputFile.delete();
        }

    }//GEN-LAST:event_jButton1ActionPerformed