public function save(array &$properties)
 {
     if (empty($properties) || !is_array($properties)) {
         throw new InvalidArgumentException('You must provide the values to update.', 400);
     }
     // Use IsPublic to determine whether to set or clear the Published datetime. -- cwells
     if (empty($properties['IsPublic'])) {
         // Not published.
         $properties['Published'] = null;
     } else {
         if ($properties['IsPublic'] === '1' && empty($properties['Published'])) {
             // New publish.
             $properties['Published'] = date(\CWA\DB\DATETIME_PHP_TO_DB);
         }
     }
     unset($properties['IsPublic']);
     // Since it's not a real property on the object.
     // The Summary should be plain text with no double quotes. -- cwells
     $properties['Summary'] = str_replace('"', "'", strip_tags($properties['Summary']));
     // If this is an existing blog post and the slug changed, move associated images. -- cwells
     if (!empty($properties['ID']) && $properties['OldSlug'] !== $properties['Slug']) {
         require_once \CWA\LIB_PATH . 'cwa/io/FileManager.php';
         $fileManager = new \CWA\IO\FileManager("../public/images{$this->pathInURL}");
         $oldPath = $properties['OldSlug'][0] . '/' . $properties['OldSlug'];
         $newPath = $properties['Slug'][0] . '/' . $properties['Slug'];
         if ($fileManager->isDirectory($oldPath)) {
             if (!$fileManager->isDirectory(dirname($newPath))) {
                 $fileManager->mkdir(dirname($newPath));
                 // Error check happens below. -- cwells
             }
             if (!$fileManager->rename($oldPath, $newPath)) {
                 throw new InvalidArgumentException('Failed to rename the image directory.', 500);
             }
             // Update any URLs that refer to the old path in the content. -- cwells
             $properties['Body'] = str_replace("/images{$this->pathInURL}/{$oldPath}/", "/images{$this->pathInURL}/{$newPath}/", $properties['Body']);
         }
     }
     unset($properties['OldSlug']);
     parent::save($properties);
 }