class UserNotification extends Model {

    public static UserNotification GetNotificationByType(String type) {
        if (legacy_types.contains(type)) {
            fixUpTable();
            type = type + " = ?";
            return new Select()
                    .from(UserNotification.class)
                    .where(type, true)
                    .orderBy("_ID desc")
                    .executeSingle();
        } else {
            final String timestamp = PersistentStore.getString("UserNotification:timestamp:" + type);
            if (timestamp.equals("")) return null;
            final String message = PersistentStore.getString("UserNotification:message:" + type);
            if (message.equals("")) return null;
            UserNotification userNotification = new UserNotification();
            userNotification.timestamp = Double.parseDouble(timestamp);
            userNotification.message = message;
            Log.d(TAG, "Workaround for: " + type + " " + userNotification.message + " timestamp: " + userNotification.timestamp);
            return userNotification;
        }
    }

}