private boolean checkResource(Collection list, int id)
    {
        boolean flag = false;
        if (list == null || id < 0) {
            return flag;
        }

        Integer obj = null;
        Iterator it = list.iterator();

        // a loop to find the match the resource id in a list
        while ( it.hasNext() )
        {
            obj = (Integer) it.next();
            if (obj.intValue() == id)
            {
                flag = true;
                break;
            }
        }

        return flag;
    }