public ActionResult Create(long structureId, string prototypeName, long? parent, ContainerView container)
        {
            var dataBaseManager = (DataBaseManager)HttpContext.Items["DataBaseManager"];

            if (!ModelState.IsValid)
            {
                var prototype = dataBaseManager.ContainerType.Get(structureId, prototypeName);

                if (prototype == null)
                    throw new HttpException((int)HttpStatusCode.NotFound, HttpStatusCode.NotFound.ToString());

                ViewBag.Prototype = prototype;
                return View(container);
            }

            try
            {
                var createContainer = dataBaseManager.Container.Create(structureId, container.Name, container.Description, parent, prototypeName);

                foreach (var password in container.Passwords.Where(p => !string.IsNullOrEmpty(p.Password)))
                    dataBaseManager.Container.AddPassword(structureId, createContainer.Id, password.RoleType, password.Password);

                return RedirectToAction("Index", new { id = createContainer.Id });
            }
            catch
            {
                return View(container);
            }
        }
        public ActionResult Create(long structureId, string prototypeName, long? parent)
        {
            var dataBaseManager = (DataBaseManager)HttpContext.Items["DataBaseManager"];

            var container = new ContainerView();

            var prototype = dataBaseManager.ContainerType.Get(structureId, prototypeName);

            if (prototype == null)
                throw new HttpException((int)HttpStatusCode.NotFound, HttpStatusCode.NotFound.ToString());

            ViewBag.Prototype = prototype;

            return View(container);
        }
        public ActionResult Delete(long structureId, long id, ContainerView containerView)
        {
            var dataBaseManager = (DataBaseManager)HttpContext.Items["DataBaseManager"];

            var container = dataBaseManager.Container.Get(id);

            if (container == null)
                throw new HttpException((int)HttpStatusCode.NotFound, HttpStatusCode.NotFound.ToString());

            try
            {
                var parent = dataBaseManager.Container.Delete(id);

                return parent != null
                           ? RedirectToAction("Index", new { id = parent.Id })
                           : RedirectToAction("Index", "Structure", new { id = structureId });
            }
            catch (Exception)
            {
                ModelState.AddGlobalError("An error has occured, please try again.");
                return View();
            }
        }