/**
  * Update an item via the update_item call
  * @param string $table The item table
  * @param mixed $hash The primary hash key
  * @param mixed|null $range The primary range key
  * @param AttributeUpdate $update
  * @param Context\Update|null $context The call context
  * @return array|null
  * @throws Exception\AttributesException
  */
 public function update($table, $hash, $range = null, AttributeUpdate $update, Context\Update $context = null)
 {
     if (null !== $this->logger) {
         $this->log('Update on table' . $table);
     }
     // Primary key
     $hash = new Attribute($hash);
     $key = array('HashKeyElement' => $hash->getForDynamoDB());
     // Range key
     if (null !== $range) {
         $range = new Attribute($range);
         $key['RangeKeyElement'] = $range->getForDynamoDB();
     }
     $attributes = array();
     foreach ($update as $name => $attribute) {
         /** @var $attribute Attribute */
         $attributes[$name] = $attribute->getForDynamoDB();
     }
     $parameters = array('TableName' => $table, 'Key' => $key, 'AttributeUpdates' => $attributes);
     if (null !== $context) {
         $parameters += $context->getForDynamoDB();
     }
     if (null !== $this->logger) {
         $this->log('Update request paramaters : ' . print_r($parameters, true), Logger::DEBUG);
     }
     $response = $this->connector->updateItem($parameters);
     if (null !== $this->logger) {
         $this->log('Update request response : ' . print_r($response, true), Logger::DEBUG);
     }
     // Update write counter
     $this->addConsumedWriteUnits($table, floatval($response['ConsumedCapacityUnits']));
     return $this->populateAttributes($response);
 }