public List<String> fetchCategories(String userId, String type){
		List<String> unsubCat = new ArrayList<String>();
		
		ResultSet rs=null;
		Connection con=null;
		PreparedStatement ps=null;
		List<String> result=new ArrayList<String>();
		try{
			String sql; 
			if(type.equals("NotSubscribed")){
				sql="SELECT DISTINCT CATEGORY_NAME FROM CATEGORY cat WHERE CATEGORY_NAME "
						+ "NOT IN (SELECT DISTINCT CATEGORY_NAME FROM CATEGORY cat WHERE CATEGORYID "
						+ "IN (SELECT C_ID FROM STUDENT_CATEGORY_MAPPING WHERE S_ID IN "
						+ "(SELECT DISTINCT S_ID FROM PERSON WHERE USERID=?)))";
			}else{
				sql="SELECT DISTINCT CATEGORY_NAME FROM CATEGORY cat WHERE CATEGORYID "
						+ "IN (SELECT C_ID FROM STUDENT_CATEGORY_MAPPING WHERE S_ID IN "
						+ "(SELECT DISTINCT S_ID FROM PERSON WHERE USERID=?))";
			}
			con=ConnectionPool.getConnectionFromPool();
			ps=con.prepareStatement(sql);
			ps.setString(1, userId);
			System.out.println("Query:: "+ps.toString());
			rs=ps.executeQuery();
			while(rs.next())
			{
				result.add(rs.getString("category_name"));
			}
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
		}
		finally{
			if(rs!=null)
			{
				try {
					rs.close();
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			if(ps!=null)
			{
				try {
					ps.close();
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
			if(con!=null)
			{
				try {
					ConnectionPool.addConnectionBackToPool(con);;
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}
		
		return result;
	}