Convert viewmodel function to object