public function validate()
 {
     $result = parent::validate();
     if (isset($this->record['moderated'])) {
         $prepend = 'Instagram_';
         $imagePrepend = 'ImageData_';
         foreach ($this->record as $key => $val) {
             if (strpos($key, $prepend) !== false) {
                 if ($val == 'approve' || $val == 'reject') {
                     $id = substr($key, strlen($prepend));
                     $post = new InstagramPost();
                     $post->MediaID = $id;
                     $post->Approved = $val == 'approve';
                     $post->ImageData = $this->record['ImageData_' . $id];
                     $post->write();
                 }
             }
         }
     }
     if (!$this->MediaID) {
         $result->error('<script>document.getElementById("Form_ItemEditForm_error").style.display="none";window.location.reload();</script>');
     }
     return $result;
 }