protected function cleanUpBlockLayout(Model\BlockInterface $block, array $data)
    {
        $clean = [];

        // TODO responsive padding
        if (isset($data[static::PADDING_TOP]) && 0 < $data[static::PADDING_TOP]) {
            $clean[static::PADDING_TOP] = $data[static::PADDING_TOP];
        }
        if (isset($data[static::PADDING_BOTTOM]) && 0 < $data[static::PADDING_BOTTOM]) {
            $clean[static::PADDING_BOTTOM] = $data[static::PADDING_BOTTOM];
        }

        $hasPreviousSize = $hasPreviousOffset = false;
        $previousSize = $previousOffset = null;

        /** @var Model\BlockInterface[] $blocks */
        $blocks = [];
        if (null !== $row = $block->getRow()) {
            $blocks = $row->getBlocks()->filter(function (Model\BlockInterface $b) use ($block) {
                return $b !== $block;
            });
        }

        $devices = array_reverse(array_keys(static::getDevices()));

        foreach ($devices as $device) {
            // Do we need to clear the previous block layout (which size is lower than 12)
            $clear = false;
            foreach ($blocks as $b) {
                $d = $b->getLayout();
                if (isset($d[$device][static::SIZE]) && 12 > $d[$device][static::SIZE]) {
                    $clear = true;
                    break;
                }
            }

            // If layout is set for this device
            if (!$clear && !isset($data[$device])) {
                continue;
            }

            $size = isset($data[$device][static::SIZE]) ? $data[$device][static::SIZE] : $previousSize;
            $offset = isset($data[$device][static::OFFSET]) ? $data[$device][static::OFFSET] : $previousOffset;

            $cleanDevice = [];

            if ($clear || ($hasPreviousSize && $previousSize != $size) || (!$hasPreviousSize && 12 > $size)) {
                $cleanDevice[static::SIZE] = $size;
            }
            if (($hasPreviousOffset && $previousOffset != $offset) || (!$previousOffset && 0 < $offset)) {
                $cleanDevice[static::OFFSET] = $offset;
            }

            if (!$hasPreviousSize && 12 > $size) {
                $hasPreviousSize = true;
            }
            if (!$hasPreviousOffset && 0 < $offset) {
                $hasPreviousOffset = true;
            }

            $previousSize = $size;
            $previousOffset = $offset;

            if (!empty($cleanDevice)) {
                $clean[$device] = $cleanDevice;
            }
        }

        return $clean;
    }