public OperatorViewModel CreateOperator(OperatorViewModel givenOperator)
        {
            if (givenOperator == null)
            {
                return null;
            }

            var newoperator = new Operator
            {
                Name = givenOperator.Name,
                Address = givenOperator.Address,
                PhoneNumber = givenOperator.PhoneNumber,
                Email = givenOperator.Email,
                Media = givenOperator.Media,
                IsVisible = givenOperator.IsVisible
            };

            this.Data.Operators.Add(newoperator);
            this.Data.SaveChanges();

            givenOperator.Id = newoperator.Id;

            return givenOperator;
        }
        public ClientViewModel CreateClient(ClientViewModel client)
        {
            var dealer = this.Data.Users
                .GetById(client.Dealer);

            var newClient = new Client
            {
                Name = client.Name,
                NameBulgarian = client.NameBulgarian,
                TypeOfCompany = client.TypeOfCompany,
                Uic = client.Uic,
                Vat = client.Vat,
                ResidenceAndAddress = client.ResidenceAndAddress,
                ResidenceAndAddressInBulgarian = client.ResidenceAndAddressInBulgarian,
                Region = client.Region,
                NetworkPage = client.NetworkPage,
                ContactPerson = client.ContactPerson,
                PhoneNumber = client.PhoneNumber,
                Email = client.Email,
                Correspondence = client.Correspondence,
                FixedPhoneService = client.FixedPhoneService,
                MobileVoiceServicesProvidedThroughNetwork = client.MobileVoiceServicesProvidedThroughNetwork,
                InternetSubs = client.InternetSubs,
                ServicesMobileAccessToInternet = client.ServicesMobileAccessToInternet,
                TvSubs = client.TvSubs,
                Coverage = client.Coverage,
                PostCode = client.PostCode,
                DealerId = client.Dealer,
                Dealer = dealer,
                Management = client.Management,
                ManagementInBulgarian = client.ManagementInBulgarian,
                ManagementPhone = client.ManagementPhone,
                ManagementEmail = client.ManagementEmail,
                Finance = client.Finance,
                FinancePhone = client.FinancePhone,
                FinanceAddress = client.FinanceAddress,
                FinanceEmail = client.FinanceEmail,
                TechnicalName = client.TechnicalName,
                TechnicalPhone = client.TechnicalPhone,
                TechnicalEmail = client.TechnicalEmail,
                Marketing = client.Marketing,
                MarketingPhone = client.MarketingPhone,
                MarketingEmail = client.MarketingEmail,
                Contracts = new List<ClientContract>(),
                Discussions = new List<Discussion>(),
                //DealerPhone = client.DealerPhone,
                //DealerEmail = client.DealerEmail,
                //DealerName = client.DealerName,
                WantToReceiveEpg = client.WantToReceiveEpg,
                WantToReceiveNews = client.WantToReceiveNews,
                IsVisible = client.IsVisible
            };

            var marketingOperator = new Operator()
            {
                Name = client.Marketing,
                PhoneNumber = client.MarketingPhone,
                Email = client.MarketingEmail
            };

            this.Data.Operators.Add(marketingOperator);
            this.Data.Clients.Add(newClient);

            this.Data.SaveChanges();

            client.Id = newClient.Id;

            return client;
        }