public async Task <IActionResult> NewAntennaAsync(Antenna antenna_temp)
        {
            //get session id (we will use it when updating data and handling errors)
            sessionID_s = HttpContext.Session.GetString("Session");
            sessionID   = Guid.Parse(sessionID_s);

            /*we can also use below lines to get correct data
             * Data d = new Data();
             * Program.data.TryGetValue(sessionID, out d);*/

            Data current = new Data();

            foreach (KeyValuePair <Guid, Data> sds in Program.data)
            {
                if (sds.Key.Equals(sessionID))
                {
                    current = sds.Value;
                }
            }

            //control if current did not came
            if (current.Receiver == null)
            {
                //it is an error
                return(RedirectToAction("NewReceiver", "Receiver"));
            }

            //handling user-may-occur mistakes
            if (antenna_temp.type.StartsWith("Select"))
            {
                current.message     = "Please select Type";
                current.LastAntenna = antenna_temp;
                Program.data.Remove(sessionID);
                Program.data.Add(sessionID, current);
                return(RedirectToAction("Preliminary", "Antenna"));
            }

            //if our antenna does not have a user friendly name we give it a default name with the code below.
            String def_name = null;
            //because we change the default name after the Radar added we we should keep it in mind to it is a default given name
            bool isNamed = false;

            if (String.IsNullOrEmpty(antenna_temp.name))
            {
                String transmitter_or_receiver_name = null;
                //if it is a transmitter antenna define it as a transmitter antenna in its name
                if (antenna_temp.duty.ToLower().Equals("transmitter"))
                {
                    transmitter_or_receiver_name = current.Transmitter.name;
                }
                //if it is a receiver or multi tasked antenna define it as a receiver in its name
                else
                {
                    transmitter_or_receiver_name = current.Receiver.name;
                }
                //this statement is for seperating receiver and multi-tasked antennas
                if (antenna_temp.duty.ToLower().Equals("both"))
                {
                    def_name = "Monostatic radar Antenna with receiver name: " + transmitter_or_receiver_name;
                }
                else
                {
                    def_name = transmitter_or_receiver_name + "s Antenna";
                }
                isNamed = true;
            }
            else
            {
                def_name = antenna_temp.name;
            }
            //end of naming

            Guid    key     = Guid.NewGuid();
            Antenna antenna = new Antenna();

            //if the antenna is both receiver and transmitter antenna give it a receiver and a transmitter id
            //Because we need a transmitter before adding an antenna which serves as transmitter antenna we should create its transmitter first.
            //After create a transmitter we can insert our antenna to database
            //all of the insertions will execute in goToRadar and Done methods
            if (antenna_temp.duty.Equals("both"))
            {
                antenna         = new Antenna(key, def_name, antenna_temp.type, antenna_temp.horizontal_beamwidth, antenna_temp.vertical_beamwidth, antenna_temp.polarization, antenna_temp.number_of_feed, antenna_temp.horizontal_dimension, antenna_temp.vertical_dimension, antenna_temp.duty, null, current.Receiver.ID, antenna_temp.location);
                antenna.Isnamed = isNamed;
                current.message = "New Antenna added to record list";
                current.ListOfAntennas.Add(antenna);
            }
            //if the antenna is a receiver antenna give it a receiver id to build a relationship between antenna and its receiver
            else if (antenna_temp.duty.Equals("receiver"))
            {
                antenna         = new Antenna(key, def_name, antenna_temp.type, antenna_temp.horizontal_beamwidth, antenna_temp.vertical_beamwidth, antenna_temp.polarization, 1, antenna_temp.horizontal_dimension, antenna_temp.vertical_dimension, antenna_temp.duty, null, current.Receiver.ID, antenna_temp.location);
                antenna.Isnamed = isNamed;
                current.message = "New Antenna added to record list";
                current.ListOfAntennas.Add(antenna);
            }
            //if the antenna is a transmitter antenna define it's transmitter with giving an attribute transmitter id
            else
            {
                Guid transmitter_id = current.Transmitter.ID;
                antenna         = new Antenna(key, def_name, antenna_temp.type, antenna_temp.horizontal_beamwidth, antenna_temp.vertical_beamwidth, antenna_temp.polarization, antenna_temp.number_of_feed, antenna_temp.horizontal_dimension, antenna_temp.vertical_dimension, antenna_temp.duty, transmitter_id, null, antenna_temp.location);
                antenna.Isnamed = isNamed;
                current.message = "New Antenna added to record list";
                current.ListOfAntennas.Add(antenna);
            }

            if (antenna_temp.ComeFromAdd)
            {
                current.message = "New Antenna added to database";
                try
                {
                    _session.BeginTransaction();
                    await _session.SaveAntenna(antenna);

                    await _session.Commit();
                }
                catch (Exception e)
                {
                    // log exception here
                    current.message = e.Message.ToString() + " Error, plase check your database connection and restart your program, Do not forgett to delete uneccessary transmitter and receiver";
                    await _session.Rollback();

                    return(RedirectToAction("Preliminary", "Antenna"));
                }
                finally
                {
                    _session.CloseTransaction();
                }
            }
            current.LastAntenna = antenna_temp;
            return(RedirectToAction("Preliminary", "Antenna"));
        }