public static function build($dir, array $plugins)
    {
        if (count($plugins) === 0) {
            throw new InvalidArgumentException('There must be at least one provided plugin for image uploader');
        }

        // Default image's quality
        $quality = 75;
        $collection = array();

        foreach ($plugins as $plugin => $options) {
            switch ($plugin) {
                case 'thumb':
                    $thumb = new ThumbFactory();
                    $collection[] = $thumb->build($dir, $quality, $options);
                break;

                case 'original':
                    $original = new OriginalSizeFactory();
                    $collection[] = $original->build($dir, $quality, $options);
                break;
            }
        }

        return new UploadChain($collection);
    }