public CustomerRegistrationResponseDto TryToRegister(CustomerRegistrationRequestDto dto)
        {
            if(uow.Users.GetAll().Where(x=>x.Username == dto.Email).FirstOrDefault() != null)
                throw new System.Exception("Invalid Email Address");

            var user = new User()
            {
                Username = dto.Email,
                Firstname = dto.Firstname,
                Lastname = dto.Lastname,
                Password = encryptionService.TransformPassword(dto.Password),
            };

            var account = new Account()
            {
                Firstname = dto.Firstname,
                Lastname = dto.Lastname,
                Email = dto.Email,
                AccountType = AccountType.Customer,
                User = user,
                AccountStatus = AccountStatus.Free
            };

            var profile = new Profile()
            {
                Name = string.Format("{0} {1}",dto.Firstname, dto.Lastname),
                Account = account,
                ProfileType = ProfileType.Customer,
                IsPersonalized = true,
                IsApproved = true,
            };

            var customer = new Customer()
            {
                Firstname = dto.Firstname,
                Lastname = dto.Lastname,
                Email = dto.Email,
                Profile = profile
            };

            user.Accounts.Add(account);
            account.Profiles.Add(profile);

            uow.Users.Add(user);
            uow.Accounts.Add(account);
            uow.Customers.Add(customer);
            uow.SaveChanges();

            var response = new CustomerRegistrationResponseDto()
            {
                Firstname = customer.Firstname,
                Lastname = customer.Lastname,
                Id = customer.Id
            };

            return response;
        }
        public BidderRegistrationResponseDto TryToRegister(BidderRegistrationRequestDto dto)
        {
            if (uow.Users.GetAll().Where(x => x.Username == dto.Email).FirstOrDefault() != null)
                throw new System.Exception("Invalid Email Address");

            var user = new User()
            {
                Username = dto.Email,
                Firstname = dto.Firstname,
                Lastname = dto.Lastname,
                Password = encryptionService.TransformPassword(dto.Password),
            };

            uow.Users.Add(user);

            var account = new Account()
            {
                Firstname = dto.Firstname,
                Lastname = dto.Lastname,
                Email = dto.Email,
                AccountType = AccountType.Bidder,
                User = user,
                AccountStatus = AccountStatus.Unpaid
            };

            user.Accounts.Add(account);

            Profile profile = Map(dto.Firstname, dto.Lastname,account,dto.BidderType);

            account.Profiles.Add(profile);

            Bidder bidder = CreateBidder(dto, profile, uow);

            uow.SaveChanges();

            var response = new BidderRegistrationResponseDto()
            {
                Firstname = bidder.Firstname,
                Lastname = bidder.Lastname,
                Id = bidder.Id
            };

            return response;
        }
        public Profile Map(string firstname, string lastname, Account account, BidderType bidderType)
        {
            var profile = new Profile();

            if (bidderType == BidderType.Caterer)
            {
                profile = new Profile()
                {
                    Name = string.Format("{0} {1}", firstname, lastname),
                    Account = account,
                    ProfileType = ProfileType.Caterer
                };
            }

            if (bidderType == BidderType.Photographer)
            {
                profile = new Profile()
                {
                    Name = string.Format("{0} {1}", firstname, lastname),
                    Account = account,
                    ProfileType = ProfileType.Photographer
                };
            }

            if (bidderType == BidderType.MakeUpArtist)
            {
                profile = new Profile()
                {
                    Name = string.Format("{0} {1}", firstname, lastname),
                    Account = account,
                    ProfileType = ProfileType.MakeUpArtist
                };
            }

            if (bidderType == BidderType.EventPlanner)
            {
                profile = new Profile()
                {
                    Name = string.Format("{0} {1}", firstname, lastname),
                    Account = account,
                    ProfileType = ProfileType.EventPlanner
                };
            }

            if (bidderType == BidderType.DiscJockey)
            {
                profile = new Profile()
                {
                    Name = string.Format("{0} {1}", firstname, lastname),
                    Account = account,
                    ProfileType = ProfileType.DiscJockey
                };
            }

            return profile;
        }