@Override
    public boolean add(PipelineConfig pipelineConfig) {
        verifyUniqueName(pipelineConfig);
        PipelineConfigs part = this.getFirstEditablePartOrNull();
        if (part == null)
            throw bomb("No editable configuration sources");

        return part.add(pipelineConfig);
    }
@Test
    public void shouldAddPipelineAtIndex_WhenWouldLandInEditablePart() {
        PipelineConfig pipeline0 = PipelineConfigMother.pipelineConfig("pipeline0");
        PipelineConfig pipeline1 = PipelineConfigMother.pipelineConfig("pipeline1");
        PipelineConfig pipeline3 = PipelineConfigMother.pipelineConfig("pipeline3");
        PipelineConfig pipeline5 = PipelineConfigMother.pipelineConfig("pipeline5");
        PipelineConfig pipeline2 = PipelineConfigMother.pipelineConfig("pipeline2");
        PipelineConfig pipeline4 = PipelineConfigMother.pipelineConfig("pipeline4");

        BasicPipelineConfigs pipelineConfigsMiddle = new BasicPipelineConfigs(pipeline3);
        pipelineConfigsMiddle.setOrigin(new FileConfigOrigin());

        BasicPipelineConfigs bottom = new BasicPipelineConfigs(pipeline0, pipeline1, pipeline2);
        BasicPipelineConfigs top = new BasicPipelineConfigs(pipeline4, pipeline5);
        bottom.setOrigin(new RepoConfigOrigin());
        top.setOrigin(new RepoConfigOrigin());

        PipelineConfigs group = new MergePipelineConfigs(
                bottom,
                pipelineConfigsMiddle,
                top);

        PipelineConfig p1 = PipelineConfigMother.pipelineConfig("pipelineToInsert");

        group.add(3, p1);
        assertThat(group, hasItem(p1));
        assertThat(pipelineConfigsMiddle, hasItem(p1));
    }