Adapted the Api code to the latest Model changes