public function updateItem(StorableInterface $item, array $properties = null)
    {
        if ($item !== null) {
            $this->setModel($item);
        }
        $model  = $this->model();
        $table  = $this->table();
        $struct = array_keys($this->tableStructure());
        $fields = $this->getModelFields($model, $properties);

        $updates = [];
        $binds   = [];
        $types   = [];
        foreach ($fields as $field) {
            $key = $field->ident();
            if (in_array($key, $struct)) {
                if ($key !== $model->key()) {
                    $param = ':'.$key;
                    $updates[] = '`'.$key.'` = '.$param;
                }
                $binds[$key] = $field->val();
                $types[$key] = $field->sqlPdoType();
            } else {
                $this->logger->debug(
                    sprintf('Field "%s" not in table structure', $key)
                );
            }
        }
        if (empty($updates)) {
            $this->logger->warning(
                'Could not update items. No valid fields were set / available in database table.',
                [
                    'properties' => $properties,
                    'structure'  => $struct
                ]
            );
            return false;
        }

        $binds[$model->key()] = $model->id();
        $types[$model->key()] = PDO::PARAM_STR;

        $query = '
            UPDATE
                `'.$table.'`
            SET
                '.implode(", \n\t", $updates).'
            WHERE
                `'.$model->key().'`=:'.$model->key().'';

        $driver = $this->db()->getAttribute(PDO::ATTR_DRIVER_NAME);
        if ($driver == self::MYSQL_DRIVER_NAME) {
            $query .= "\n".'LIMIT 1';
        }

        $result = $this->dbQuery($query, $binds, $types);

        if ($result === false) {
            return false;
        } else {
            return true;
        }
    }