@SuppressWarnings("unchecked")
  private Object checkTypeAndReturnObject(Column column, Class clazz) {
    if (clazz.isAssignableFrom(column.getType()) ||
        clazz == Long.class && java.util.Date.class.isAssignableFrom(column.getType())) {
      if (columns.containsKey(column)) {
        return columns.get(column);
      } else {
        throw new RuntimeException("Column " + column.toString() + " is not included in the query");
      }
    } else {
      throw new RuntimeException("Column " + column.toString() + " is not compatible with type " + clazz.getSimpleName());
    }
  }