public function offsetSet($offset, $value)
 {
     if (!is_a($value, 'PodioLib\\Models\\PodioItem')) {
         throw new PodioDataIntegrityError("Objects in PodioItemCollection must be of class PodioItem");
     }
     parent::offsetSet($offset, $value);
 }
 /**
  * Array access. Set fiels using external id or offset.
  */
 public function offsetSet($offset, $field)
 {
     // Allow you to set external id in the array offset.
     // E.g. $collection['external_id'] = $field;
     if (is_string($offset)) {
         $field->external_id = $offset;
         $offset = null;
     }
     if (!$field->id && !$field->external_id) {
         throw new PodioDataIntegrityError('Field must have id or external_id set.');
     }
     // Remove any existing field with this id
     $this->remove($field->id ? $field->id : $field->external_id);
     // Add to internal storage
     parent::offsetSet($offset, $field);
 }