added null checks to cart and product repo finally clause resource implementations