@Override
    public Path mkdir(final Path folder, final TransferStatus status) throws BackgroundException {
        try {
            if(containerService.isContainer(folder)) {
                final B2BucketResponse response = session.getClient().createBucket(containerService.getContainer(folder).getName(),
                        null == status.getRegion() ? BucketType.valueOf(new B2BucketTypeFeature(session, fileid).getDefault().getIdentifier()) : BucketType.valueOf(status.getRegion()));
                final EnumSet<Path.Type> type = EnumSet.copyOf(folder.getType());
                type.add(Path.Type.volume);
                return folder.withType(type).withAttributes(new B2AttributesFinderFeature(session, fileid).toAttributes(response));
            }
            else {
                final EnumSet<Path.Type> type = EnumSet.copyOf(folder.getType());
                type.add(Path.Type.placeholder);
                return new B2TouchFeature(session, fileid).touch(folder.withType(type), status
                        .withMime(MimeTypeService.DEFAULT_CONTENT_TYPE)
                        .withChecksum(writer.checksum(folder, status).compute(new NullInputStream(0L), status)));
            }
        }
        catch(B2ApiException e) {
            throw new B2ExceptionMappingService(fileid).map("Cannot create folder {0}", e, folder);
        }
        catch(IOException e) {
            throw new DefaultIOExceptionMappingService().map("Cannot create folder {0}", e, folder);
        }
    }
@Test(expected = ConflictException.class)
    public void testBucketExists() throws Exception {
        final Path bucket = new Path("/test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
        try {
            new B2DirectoryFeature(session, new B2VersionIdProvider(session)).mkdir(bucket, new TransferStatus());
        }
        catch(ConflictException e) {
            assertEquals("Bucket name is already in use. Please contact your web hosting service provider for assistance.", e.getDetail());
            assertEquals("Cannot create folder test-cyberduck.", e.getMessage());
            throw e;
        }
    }