public function asArray(Context $context)
 {
     $children = [];
     $fields = [];
     $vulnerabilities = $this->vulnerabilityTreeAsArray($context->getVulnerabilityElement());
     if ($context->hasFields()) {
         $fieldsArr = [];
         foreach ($context->getFields() as $field) {
             $fieldsArr[] = $this->renderField($field);
         }
         $fields = $fieldsArr;
     }
     if ($context->hasChildren()) {
         $childrenArr = [];
         foreach ($context->getChildrenArray() as $child) {
             $childrenArr[$child->getName()] = $this->asArray($child);
         }
         $children = $childrenArr;
     }
     $result = ['name' => $context->getName(), 'type' => $context->getType(), 'technology' => $context->getTechnology()];
     if ($context->getMappedTo()) {
         $result['mapped_to'] = $context->getMappedTo();
     }
     if ($context->getStorageRole() != Context::STORAGE_ROLE_CHILD) {
         $result['storage_role'] = $context->getStorageRole();
     }
     if (count($fields)) {
         $result['fields'] = $fields;
     }
     if (count($vulnerabilities)) {
         $result['vulnerabilities'] = $vulnerabilities;
     }
     if (count($children)) {
         $result['children'] = $children;
     }
     return $result;
 }