I see you refactored this block into the model. Please still keep the error handling!