public static boolean isDateWithinPeriod (Date date, Date fromDate, Date toDate){
    return date == null
      ||((fromDate == null
          || fromDate.equals(date)
          || fromDate.before(date))
        && (toDate == null
            || toDate.equals(date)
            || toDate.after(date)));

  }