src/main/java/org/intellimate/izou/sdk/frameworks/music/resources/PlaybackStateResource.java
public static Optional<PlaybackState> getPlaybackStateFromResource(ResourceModel x) {
        if (!x.getResourceID().equals(ID))
            return Optional.empty();
        Object resource = x.getResource();
        if (resource instanceof String) {
            String state = (String) resource;
            try {
                return Optional.of(PlaybackState.valueOf(state));
            } catch (IllegalArgumentException e) {
                return Optional.empty();
            }
        } else {
            return Optional.empty();
        }
    }
public static Optional<PlaybackState> getPlaybackStateFromResource(ResourceModel x) {
        if (!x.getResourceID().equals(ID))
            return Optional.empty();
        Object resource = x.getResource();
        if (resource instanceof String) {
            String state = (String) resource;
            try {
                return Optional.of(PlaybackState.valueOf(state));
            } catch (IllegalArgumentException e) {
                return Optional.empty();
            }
        } else {
            return Optional.empty();
        }
    }
returns the PlaybackState from the resource
@param x the resourceModel
@return the optional Playbackstate (empty if illegal resource)