more refactory on repo and web api