Return empty cart when cart cannot be retrieved from database

also return cart passed as parameter when cart cannot be stored into database