class NewStubDescriptorCommand implements StubDescriptorModificationCommand {

    @Override
    public Map<String, StubDescriptor> modify(final Map<String, StubDescriptor> stubDescriptors) {
        Map<String, StubDescriptor> updated = new LinkedHashMap<>(stubDescriptors);
        StubDescriptor stubDescriptor = stubConfigurationJsonBuilder.buildStubDescriptor(inputStream);
        StubDescriptorAttributes attributes = stubDescriptor.getAttributes();
        String groupName = attributes.getGroupName();
        sequenceDescriptorHolder.addAllSequenceDescriptors(stubDescriptor);
        updated.put(groupName, stubDescriptor);
        if (!attributes.isValid()) {
            updated.remove(groupName);
        }
        return updated;
    }

    public  NewStubDescriptorCommand(final InputStream inputStream, final StubDescriptorJsonFactory stubConfigurationJsonBuilder,
                                    final SequenceDescriptorHolder sequenceDescriptorHolder);

}