code: public function add(Theme $theme, array $pageValues)
      {
          $pageName = $pageValues["name"];
          $pageDir = $this->pagesDir . '/' . $pageName;
          $this->pageExists($pageDir);
  
          // @codeCoverageIgnoreStart
          if (!@mkdir($pageDir)) {
              $this->folderNotCreated($pageDir);
          }
          // @codeCoverageIgnoreEnd
  
          $seoValues = $pageValues["seo"];
          unset($pageValues["seo"]);
          $encodedPage = json_encode($pageValues);
          $pageFile = $pageDir . '/' . $this->pageFile;
          $event = Dispatcher::dispatch(PageCollectionEvents::PAGE_COLLECTION_ADDING, new PageCollectionAddingEvent($pageFile, $encodedPage));
          $encodedPage = $event->getFileContent();
          FilesystemTools::writeFile($pageFile, $encodedPage);
          if ($this->pageFile != 'page.json') {
              FilesystemTools::writeFile($pageDir . '/page.json', $encodedPage);
          }
  
          foreach ($seoValues as $seoValue) {
              $languageName = $seoValue["language"];
              unset($seoValue["language"]);
  
              $languageDir = $pageDir . '/' . $languageName;
              @mkdir($languageDir);
              FilesystemTools::writeFile($languageDir . '/' . $this->seoFile, json_encode($seoValue));
              $theme->addTemplateSlots($pageValues["template"], $this->username);
          }
  
          Dispatcher::dispatch(PageCollectionEvents::PAGE_COLLECTION_ADDED, new PageCollectionAddedEvent($pageFile, $encodedPage));
          DataLogger::log(sprintf('Page "%s" was successfully added to the website', $pageName));
  
          return $pageValues;
      }
docs: Adds a new page to the website using the given template from the given theme
  
  @param \RedKiteCms\Content\Theme\Theme $theme
  @param $pageValues
  
  @return array Tha added page