public ActionResult Create([Bind(Include = "FlightId,Flight_Nr,From,To,ArriveTime,ExpectedTime,StatusId,CompanyId,FlightType,CreatedOnDate,LastModifiedOnDate,CreatedByUserId,LastModifiedByUserId,IsDeleted")] Flights flights)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    flights.CreatedByUserId      = User.Identity.GetUserId();
                    flights.LastModifiedByUserId = User.Identity.GetUserId();
                    flights.CreatedOnDate        = DateTime.Now;
                    flights.LastModifiedOnDate   = DateTime.Now;
                    flights.IsDeleted            = false;
                    flightRepository.InsertFlight(flights);
                    flightRepository.Save();

                    return(RedirectToAction("Index"));
                }
            }
            catch (DataException)
            {
                ModelState.AddModelError(string.Empty, "Unable to save changes. Try again.");
            }

            ViewBag.CompanyId = new SelectList(db.Companies, "Id", "Name", flights.CompanyId);
            ViewBag.StatusId  = new SelectList(db.Statuses, "StatusId", "Name", flights.StatusId);
            return(View(flights));
        }