Convert to Knockout js for MVVM