public String deleteProfiles(String inJson) {
		String retval = new String();
		boolean retbool;
		int retcode;
		
		try {
			JSONObject jo  = new JSONObject(inJson);
			JSONArray keys = jo.getJSONArray("key");
			
			Connection conn = dbConn.getConnection();
			PreparedStatement pstmt = conn.prepareStatement(
					"delete from app.profiles where key = ?");
			PreparedStatement pstmt2 = conn.prepareStatement(
					"delete from app.configuration where pid = ?");
			PreparedStatement pstmt3 = conn.prepareStatement(
					"select drop_profile_view(?)");
			PreparedStatement keyStmt = conn.prepareStatement(
					"select id from app.profiles where key = ?");
			
			for(int i=0;i<keys.size();i++){
				
				keyStmt.setString(1,keys.getString(i));
				ResultSet rs = keyStmt.executeQuery();
				
				if( rs.next() ) {
					int id = rs.getInt("id");
					pstmt2.setInt(1, id);
					pstmt2.execute();
					pstmt3.setInt(1, id);
					pstmt3.execute();
				}
				pstmt.setString(1, keys.getString(i));
				pstmt.execute();
				
				rs.close();
			}
			
			retval = "Sucessfully completed";
			retcode= 201;
			retbool= true;
			
			pstmt.close();
			conn.close();
		}
		catch( JSONException jex ) {
			retval = "JSON Exception Error";
			retcode= 404;
			retbool= false;
			jex.printStackTrace();
		}
		catch( Exception e ) {
			retval = "Database Exception Error";
			retcode= 404;
			retbool= false;
			e.printStackTrace();
		}
		
		JSONObject robj = new JSONObject();
		JSONObject rstat= new JSONObject();
		try {
			rstat.put("code"   , retcode);
			rstat.put("success", retbool );
			rstat.put("message", retval);
			
			robj.put("status", rstat);
		}
		catch(Exception exception) {;}
		
		return robj.toString();
	}