Using closure of generic to handle generic issue of State