public ActionResult EditEvent(int id)
        {
            // this is page for edit or create new event. So user must have one of these rights too!
            if (!RightManager.Instance.HasUserRight(false,
                RightEnum.EVENT___ADMINISTRATION_ONLY_MY_EVENT,
                RightEnum.EVENT___ADMINISTRATION_EVERYONE_ITEM))
                throw new Exception("Uživatel nemá dostatečná práva vytvářet nebo editovat události");

            if (RightManager.Instance.GetLoggedUserEventAccessibilityTypesByRights().Count() <= 0)
                throw new Exception("Uživatel nemá práva k žádné přístupnosti události");

            LinkCssFile("EditEvent.css");

            // Create new or update existing event
            EventModelNew eventModel = null;
            if (id > 0)
            {
                var dbEvent = Locator.GetDbEventManager().GetEventById(id);
                if (dbEvent == null)
                    throw new HttpException(404, "Událost nenalezena");

                eventModel = ModelConvertor.ConvertToEventModelNew(dbEvent);

                // has user acces to this event? (public, private, confinedtial ...)
                if (!eventModel.HasRightToAccess())
                    throw new Exception("Uživatel nemá dostatečná práva pro přistup k události");
            }
            else
            {
                var now = DateTime.Now.AddDays(1);

                eventModel = new EventModelNew()
                {
                    DateFrom           = new DateTime(now.Year, now.Month, now.Day, 12, 0, 0),
                    Created            = DateTime.Now,
                    Creator            = ModelConvertor.ConvertToUserModel(RightManager.Instance.LoggedUserSession),
                    EventType          = new EventTypeModel() {Id = 1},
                    EventAccessibility = new EventAccessibilityModel() {Id = 1},
                    Files              = new List<FileModel>()
                };
            }

            // prepare event model
            var model = new EditEventModel()
            {
                AccessibilityTypes =
                    Locator.GetDbEventManager()
                        .GetEventAccessibilityList(RightManager.Instance.GetLoggedUserEventAccessibilityTypesByRights()),
                EventTypes = Locator.GetDbEventManager().GetEventTypeList(),
                Message = MessageTransporter,
                Event = eventModel
            };

            return View(model);
        }
        public ActionResult InsertUpdateEvent(EditEventModel model, IEnumerable<HttpPostedFileBase> files)
        {
            var eventId = model.Event.Id;

            var evnt = ModelConvertor.ConvertToEVENT(model.Event);

            if (files != null && files.Any() && files.First() != null)
            {
                evnt.FILE_INFO = new Collection<FILE_INFO>();
                foreach (var file in files)
                {
                    // prepare file info
                    var finfo = new FILE_INFO(){FileName = file.FileName, ContentType = file.ContentType, EventId = evnt.Id};

                    // prepares file content for file info
                    finfo.FILE_CONTENT = new FILE_CONTENT() { FILE_INFO = finfo, FileContent = new byte[file.InputStream.Length], };

                    // prepare file content as byte array
                    file.InputStream.Read(finfo.FILE_CONTENT.FileContent, 0, (int)file.InputStream.Length);

                    evnt.FILE_INFO.Add(finfo);
                }
            }

            if (model.IsUpdate())
            {
                if (!model.Event.HasRightToEdit())
                    throw new Exception("Uživatel nemá dostatečná práva pro úpravu události");

                Locator.GetDbEventManager().UpdateEvent(evnt);
                MessageTransporter.SetMessage("Aktualizace události proběhla úspěšně");
            }
            else
            {
                if (!model.Event.HasRightToEdit())
                    throw new Exception("Uživatel nemá dostatečná práva pro vytvoření nové události");

                eventId = Locator.GetDbEventManager().CreateEvent(evnt);
                MessageTransporter.SetMessage("Vytoření události proběhlo úspěšně");
            }

            return RedirectToAction("EditEvent", "Event", new {Id = eventId});
        }