protected function formatAttributes($entityClass, array $attributes, $format = Attribute::FORMAT_PUT)
    {
        $entityClass = $this->getEntityClass($entityClass);
        $formatted = array();

        $mappings = $entityClass::getDataTypeMappings();
        foreach ($attributes as $attribute => $value) {
            if (isset($mappings[$attribute])) {
                $dataType = $mappings[$attribute];
                if (Attribute::FORMAT_PUT == $format) {
                    $formatted[$attribute] = array($dataType => $value);
                } else {
                    $formatted[$attribute] = array('Value' => array($dataType => $value));
                }
            } else {
                $formatted[$attribute] = Attribute::factory($value)->getFormatted($format);
            }
        }

        return $formatted;
    }