Add error handling
Move database input to model
Add error/success handling
Add error catch