class UserNotification extends Model {

    public static UserNotification create(String message, String type, long timestamp) {
        UserNotification userNotification = new UserNotification();
        userNotification.timestamp = timestamp;
        userNotification.message = message;
        switch (type) {
            case "bg_alert":
                userNotification.bg_alert = true;
                break;
            case "calibration_alert":
                userNotification.calibration_alert = true;
                break;
            case "double_calibration_alert":
                userNotification.double_calibration_alert = true;
                break;
            case "extra_calibration_alert":
                userNotification.extra_calibration_alert = true;
                break;
            case "bg_unclear_readings_alert":
                userNotification.bg_unclear_readings_alert = true;
                break;
            case "bg_missed_alerts":
                userNotification.bg_missed_alerts = true;
                break;
            case "bg_rise_alert":
                userNotification.bg_rise_alert = true;
                break;
            case "bg_fall_alert":
                userNotification.bg_fall_alert = true;
                break;
            default:
                Log.d(TAG, "Saving workaround for: " + type + " " + message);
                PersistentStore.setString("UserNotification:timestamp:" + type, JoH.qs(timestamp));
                PersistentStore.setString("UserNotification:message:" + type, message);
                return null;
        }
        userNotification.save();
        return userNotification;

    }

}