public function insert(CategoryDto $categoryDto) { $category = new Category(); if ($category->load(['Category' => ArrayHelper::toArray($categoryDto)])) { $category->insert(); return ArrayHelper::toArray($category, ['common\\models\\Category' => $categoryDto->activeAttributes()]); } else { return []; } }