prepareError receives an array of errors and return *model.Error object with a message and error code, we can extend this function to add more error types/code