add input param checking before DB call