private void modifyCategory(Map<String, Object> jsonrpc2Params) throws Exception {
        Map<String, Object> params = getParams(jsonrpc2Params,
                new NullableExtendedParam(Constants.Param.Name.TYPE, false),
                new NullableExtendedParam(Constants.Param.Name.CATEGORY_ID, false),
                new NullableExtendedParam(Constants.Param.Name.HEADLINE, true),
                new NullableExtendedParam(Constants.Param.Name.COLOR_CODE, true));

        String type = (String) params.get(Constants.Param.Name.TYPE);
        int categoryId = (Integer) params.get(Constants.Param.Name.CATEGORY_ID);
        String headLine = (String) params.get(Constants.Param.Name.HEADLINE);
        Integer colorCode = (Integer) params.get(Constants.Param.Name.COLOR_CODE);


        //TODO: Private and public categories should extend each other somehow so we do not need duplicate code.
        if(type.equals(Constants.Param.Value.PUBLIC)){
            Category category = em.find(Category.class, categoryId);
            if(category == null){
                responseParams.put(Constants.Param.Status.STATUS, Constants.Param.Status.OBJECT_NOT_FOUND);
                return;
            }
            if(headLine != null){
                category.setHeadLine(headLine);
            }
            if(colorCode != null){
                category.setColorCode(colorCode);
            }
            persistObjects(category);
            responseParams.put(Constants.Param.Status.STATUS, Constants.Param.Status.SUCCESS);
            responseParams.put(Constants.Param.Name.CATEGORY, serialize(category));

        }else if(type.equals(Constants.Param.Value.PRIVATE)){
            PrivateCategory category = em.find(PrivateCategory.class, params.get(categoryId));
            if(category == null){
                responseParams.put(Constants.Param.Status.STATUS, Constants.Param.Status.OBJECT_NOT_FOUND);
                return;
            }
            if(headLine != null){
                category.setHeadLine(headLine);
            }
            if(colorCode != null){
                category.setColorCode(colorCode);
            }
            persistObjects(category);
            responseParams.put(Constants.Param.Status.STATUS, Constants.Param.Status.SUCCESS);
            responseParams.put(Constants.Param.Name.CATEGORY, serialize( category));

        }else{
            throwJSONRPC2Error(JSONRPC2Error.INVALID_PARAMS, Constants.Errors.PARAM_VALUE_NOT_ALLOWED, "Type: " + type);
        }
    }