implement logic in knockoutjs