/**
  * @param array                      $data
  * @param Person\AbstractMember|null $person
  *
  * @return Person
  */
 public function create(array $data = [], $person = null)
 {
     if (!is_object($person)) {
         if (array_key_exists('character', $data)) {
             $person = new CastMember();
         }
         if (array_key_exists('job', $data)) {
             $person = new CrewMember();
         }
         if (null === $person) {
             $person = new Person();
         }
     }
     if (array_key_exists('profile_path', $data)) {
         $person->setProfileImage($this->getImageFactory()->createFromPath($data['profile_path'], 'profile_path'));
     }
     if ($person instanceof Person) {
         /** Images */
         if (array_key_exists('images', $data)) {
             $person->setImages($this->getImageFactory()->createCollectionFromPeople($data['images']));
         }
         if (array_key_exists('changes', $data)) {
             $person->setChanges($this->getChangeFactory()->createCollection($data['changes']));
         }
         /** External ids */
         if (array_key_exists('external_ids', $data)) {
             $person->setExternalIds($this->hydrate(new ExternalIds(), $data['external_ids']));
         }
         if (array_key_exists('tagged_images', $data)) {
             $person->setTaggedImages($this->getImageFactory()->createResultCollection($data['tagged_images'], 'createMediaImage'));
         }
         /** External ids */
         if (array_key_exists('known_for', $data)) {
             $person->setKnownFor($this->createGenericCollectionFromMediaTypes($data['known_for']));
         }
         /** Credits */
         $this->applyCredits($data, $person);
     }
     return $this->hydrate($person, $data);
 }