public Transaction AddNewTransaction(DateTime date, string companyId, int amount, decimal price, bool buy, decimal fee, int groupId)
        {
            CompanyController companyController = new CompanyController();
            GroupController groupController = new GroupController();
            Transaction t = new Transaction();

            #region checking if company symbol exists in table, if not then we must add it
		    Company company = companyController.GetCompany(companyId);
            if (company == null)
            {
                companyController.AddNewCompany(companyId, "brak");
            } 
	        #endregion

            #region processing TransactionGroup

            TransactionGroup group = null;
            if(groupId == 0) //adding new group
            {
                group = groupController.AddNewTransGroup(companyId);
            }
            else
            {
                group = groupController.GetGroup(groupId);
                if (group == null)
                {
                    groupController.AddNewTransGroup(companyId);
                }
            }
            #endregion

            t.Amount = amount;
            t.Price = price;
            t.Fee = fee;
            t.Date = date;
            t.Group = group;
            t.GroupId = group.ID;
            t.Value = price * amount + fee; ;
            t.Buy = buy;

            try
            {
                t = Repository<Transaction>.Save(t);
                UnitOfWork.Current.TransactionalFlush();
            }
            catch (Exception ex)
            {
                UnitOfWork.CurrentSession.Clear();
                throw;
            }

            //t = Repository<Transaction>.Get(t.ID);
            return t;
        }