ExoPortletInstanceContext instanceContext;
// TODO: we should not be having these wsrp specific conditions through the code like
// this, it should either work the same was as normal portlets or abstracted out to another class.
if (ApplicationType.WSRP_PORTLET.equals(state.getApplicationType())) {
WSRP wsrp = (WSRP) preferencesPortletContext.getState();
AccessMode accessMode = AccessMode.CLONE_BEFORE_WRITE;
if (wsrp.getState() != null) {
StatefulPortletContext statefulPortletContext = StatefulPortletContext.create(
preferencesPortletContext.getId(), PortletStateType.OPAQUE, wsrp.getState());