public function listAction(Request $request)
	{
		$rootNodes = array();

		$repo = $this->container->getDoctrine()
			->getManager()->getRepository('Supra\Package\Cms\Entity\Abstraction\File');

		$output = array();

		// if parent dir is set then we set folder as rootNode
		if ($request->query->get('id')) {
			$node = $this->getFolder('id');
			$rootNodes = $node->getChildren();
		} else {
			$rootNodes = $repo->getRootNodes();
		}

		foreach ($rootNodes as $rootNode) {
			/* @var $rootNode FileAbstraction */

			if ($request->query->get('type')) {

				$itemType = $this->getEntityType($rootNode);
				$requestedType = $request->query->get('type');

				if ( ! (
					($itemType == $requestedType) ||
					($itemType == Folder::TYPE_ID)
				)) {
					continue;
				}
			}

			$item = $this->entityToArray($rootNode);

			if ($rootNode instanceof File) {

				$extension = mb_strtolower($rootNode->getExtension());

				$knownExtensions = $this->container->getParameter('cms.media_library_known_file_extensions');
				if (in_array($extension, $knownExtensions)) {
					$item['known_extension'] = $extension;
				}

				$checkExistance = $this->container->getParameter('cms.media_library_check_file_existence');
				if ($checkExistance == self::CHECK_FULL) {
					$item['broken'] = ( ! $this->isAvailable($rootNode));
				}
			}

			// Get thumbnail
			if ($rootNode instanceof Image) {
				// create preview
				// TODO: hardcoded 30x30
				try {
					if ($this->getFileStorage()->fileExists($rootNode)) {
						$sizeName = $this->getFileStorage()->createResizedImage($rootNode, 30, 30, true);
						if ($rootNode->isPublic()) {
							$item['thumbnail'] = $this->getFileStorage()->getWebPath($rootNode, $sizeName);
						} else {
							$item['thumbnail'] = $this->getPrivateImageWebPath($rootNode, $sizeName);
						}
					}
				} catch (\Exception $e) {
					$item['broken'] = true;
				}
			}

			$output[] = $item;
		}

		return new SupraJsonResponse(array(
			'totalRecords' => count($output),
			'records' => $output,
		));
	}