/// <summary>
        /// Sells the stock.
        /// </summary>
        /// <exception cref="Exception">
        /// Invalid stock id
        /// No. of shares you mentioned are not available in stock or invalid input
        /// </exception>
        public void SellStock()
        {
            ////creating the object of customer class
            CustomerData          customer       = new CustomerData();
            IList <CustomerModel> customerModels = customer.GetAllCustomer();

            Console.WriteLine("id \t name \t valuation");
            ////this is used for reading the data in customerModels
            foreach (var items in customerModels)
            {
                Console.WriteLine(items.Id + "\t" + items.Name + "\t" + items.Valuation);
            }

            Console.WriteLine("Please enter the selling customer id");
            int customerId = Convert.ToInt32(Console.ReadLine());
            ////creating the object of stock data
            StockData stockData = new StockData();
            IList <StockDataModel> stockModels = stockData.GetStock();

            Console.WriteLine("id \tname \tnumberofshares \tpricepershare");
            foreach (var items in stockModels)
            {
                Console.WriteLine(items.Id + "\t" + items.Name + "\t" + items.NumberOfShares + "\t" + items.PricePerShare);
            }

            Console.WriteLine("Please enter the Stock Id to which stock you want to sell");
            int            stockId        = Convert.ToInt32(Console.ReadLine());
            StockDataModel stockDataModel = null;
            bool           stockFl        = true;

            ////this loop is used for printing the data in stock model
            foreach (var items in stockModels)
            {
                if (items.Id == stockId)
                {
                    stockDataModel = items;
                    Console.WriteLine(items.Id + "\t" + items.Name + "\t" + items.NumberOfShares + "\t" + items.PricePerShare);
                    stockFl = false;
                }
            }

            if (stockFl == true)
            {
                throw new Exception("Invalid stock id");
            }

            Console.WriteLine("Enter the number of shares need to sell");
            ////taking the input from the user
            int    numberOfShares  = Convert.ToInt32(Console.ReadLine());
            string customerName    = string.Empty;
            string stockName       = string.Empty;
            int    amountValuation = 0;

            if (numberOfShares > 0)
            {
                ////int priceOfShare = 0;
                bool stockFlag = true;
                ////this loop is used for searching the entered id
                foreach (var items in stockModels)
                {
                    ////this condition is used for checkint the data present in the stock
                    if (items.Id == stockId)
                    {
                        items.NumberOfShares = items.NumberOfShares + numberOfShares;
                        this.priceOfShare    = items.PricePerShare * numberOfShares;
                        stockName            = items.Name;
                        stockFlag            = false;
                    }
                }

                if (stockFlag == true)
                {
                    throw new Exception("Invalid stock id");
                }

                bool customerFlag = true;
                foreach (var item in customerModels)
                {
                    ////this condition is used for
                    if (item.Id == customerId)
                    {
                        item.Valuation  = item.Valuation + this.priceOfShare;
                        customerName    = item.Name;
                        amountValuation = item.Valuation;
                        customerFlag    = false;
                    }
                }

                if (customerFlag == true)
                {
                    throw new Exception("Invalid customer id");
                }
            }
            else
            {
                throw new Exception("No. of shares you mentioned are not available in stock or invalid input");
            }

            ////creating the object of transactionModel
            TransactionModel transactionModel = new TransactionModel()
            {
                CustomerName    = customerName,
                StockName       = stockName,
                NoOfShares      = numberOfShares,
                Amount          = this.priceOfShare * numberOfShares,
                Time            = DateTime.Now.ToString(),
                TransactionType = TransactionType.Sell
            };

            IList <TransactionModel> transactionModels = Transaction.GetAllTransactions();

            transactionModels.Add(transactionModel);
            Constants constants = new Constants();

            ////writing the stock in to the file
            Transaction.WriteFile(constants.StockFile, stockModels);
            ////writing the customer in to the file
            Transaction.WriteFile(constants.CustomerDetails, customerModels);
            ////writing the transaction in to file
            Transaction.WriteFile(constants.TransactionFile, transactionModels);
            Console.WriteLine("selling is successfull");
        }