Catch exceptions and cache entity.