Function createCursorFromState