virtual bool interpretCommand(RiaSocketServer* server, const QList<QByteArray>&  args, QDataStream& socketStream)
    {
        RiuMainWindow* ruiMainWindow = RiuMainWindow::instance();
        if (ruiMainWindow)
        {
            std::vector<RimCase*> cases;
            ruiMainWindow->selectedCases(cases);

            std::vector<qint64>  caseIds;
            std::vector<QString> caseNames;
            std::vector<QString>  caseTypes;
            std::vector<qint64>  caseGroupIds;

            getCaseInfoFromCases(cases, caseIds, caseNames, caseTypes, caseGroupIds);

            quint64 byteCount = sizeof(quint64);
            quint64 selectionCount = caseIds.size();

            for (size_t i = 0; i < selectionCount; i++)
            {
                byteCount += 2*sizeof(qint64);
                byteCount += caseNames[i].size() * sizeof(QChar);
                byteCount += caseTypes[i].size() * sizeof(QChar);
            }

            socketStream << byteCount;
            socketStream << selectionCount;

            for (size_t i = 0; i < selectionCount; i++)
            {
                socketStream << caseIds[i];
                socketStream << caseNames[i];
                socketStream << caseTypes[i];
                socketStream << caseGroupIds[i];
            }
        }

        return true;
    }
    virtual bool interpretCommand(RiaSocketServer* server, const QList<QByteArray>&  args, QDataStream& socketStream)
    {
        int argCaseGroupId = -1;

        if (args.size() == 2)
        {
            argCaseGroupId = args[1].toInt();
        }

        RimProject* proj = RiaApplication::instance()->project();
        RimEclipseCaseCollection* analysisModels = (proj && proj->activeOilField()) ? proj->activeOilField()->analysisModels() : NULL;
        if (analysisModels)
        {

            std::vector<RimCase*> cases;
            if (argCaseGroupId == -1)
            {
                proj->allCases(cases);
            }
            else
            {
                RimIdenticalGridCaseGroup* caseGroup = NULL;
                for (size_t i = 0; i < analysisModels->caseGroups().size(); i++)
                {
                    RimIdenticalGridCaseGroup* cg = analysisModels->caseGroups()[i];

                    if (argCaseGroupId == cg->groupId())
                    {
                        caseGroup = cg;
                    }
                }

                if (caseGroup)
                {
                    for (size_t i = 0; i < caseGroup->statisticsCaseCollection()->reservoirs.size(); i++)
                    {
                        cases.push_back(caseGroup->statisticsCaseCollection()->reservoirs[i]);
                    }

                    for (size_t i = 0; i < caseGroup->caseCollection()->reservoirs.size(); i++)
                    {
                        cases.push_back(caseGroup->caseCollection()->reservoirs[i]);
                    }
                }
            }


            std::vector<qint64>  caseIds;
            std::vector<QString> caseNames;
            std::vector<QString> caseTypes;
            std::vector<qint64>  caseGroupIds;

            getCaseInfoFromCases(cases, caseIds, caseNames, caseTypes, caseGroupIds);

            quint64 byteCount = sizeof(quint64);
            quint64 caseCount = caseIds.size();

            for (size_t i = 0; i < caseCount; i++)
            {
                byteCount += 2*sizeof(qint64);
                byteCount += caseNames[i].size() * sizeof(QChar);
                byteCount += caseTypes[i].size() * sizeof(QChar);
            }

            socketStream << byteCount;
            socketStream << caseCount;

            for (size_t i = 0; i < caseCount; i++)
            {
                socketStream << caseIds[i];
                socketStream << caseNames[i];
                socketStream << caseTypes[i];
                socketStream << caseGroupIds[i];
            }
        }

        return true;
    }