protected function regionUpdate(Layout $layout, Region $region)
    {
        if ($region->isUpdated()) {

            $this
                ->db
                ->delete('ucms_layout_data')
                ->condition('layout_id', $layout->getId())
                ->condition('region', $region->getName())
                ->execute()
            ;

            $values = [];

            /* @var $item Item */
            foreach ($region as $delta => $item) {
                $values[] = [
                    $layout->getId(),
                    $region->getName(),
                    $item->getNodeId(),
                    $delta,
                    $item->getViewMode(),
                ];
            }

            if (!empty($values)) {
                $q = $this->db->insert('ucms_layout_data');
                $q->fields(['layout_id', 'region', 'nid', 'weight', 'view_mode']);
                foreach ($values as $row) {
                    $q->values($row);
                }
                $q->execute();
            }

            // And create the node references

            $region->toggleUpdateStatus(false);

            return true;
        }

        return false;
    }