private void writeImgDataToFile(byte[] imgData, BaseImage imgObj) {
        if (ArrayUtils.isEmpty(imgData)) {
            throw new IllegalArgumentException("the arg: imgData can not be null or empty");
        }

        if (imgObj == null || StringUtils.isEmpty(imgObj.getLocalPath())) {
            throw new IllegalArgumentException("the arg:imgObj can not be null " +
                "and the it's property: localPath can not be null or empty");
        }

        FileOutputStream fs = null;
        try {
            File imgFile = new File(imgObj.getLocalPath());
            logger.debug("will create image file at path:" + imgObj.getLocalPath());
            boolean createImgFileSuccess = imgFile.createNewFile();
            if (createImgFileSuccess) {
                fs = new FileOutputStream(imgFile);
                fs.write(imgData);
                fs.flush();
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fs != null) {
                try {
                    fs.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }