private Image getImage(String title) {
        PersistenceManager pm = PMF.get().getPersistenceManager();

        // Search for any Image object with the passed-in title; limit the number
        // of results returned to 1 since there should be at most one image with
        // a given title
        Query query = pm.newQuery(Image.class, "title == titleParam");
        query.declareParameters("String titleParam");
        query.setRange(0, 1);

        try {
            List<Image> results = (List<Image>) query.execute(title);
            if (results.iterator().hasNext()) {
                // If the results list is non-empty, return the first (and only)
                // result
                return results.get(0);
            }
        } finally {
            query.closeAll();
            pm.close();
        }

        return null;
    }