public DetailedCustomerViewModel(Customer customer, List<Appointment> appointments, List<Review> reviews)
        {
            this.Username = customer.UserName;
            this.Email = customer.Email;
            this.PhoneNumber = customer.PhoneNumber;
            this.Gender = customer.Gender.ToString();
            this.reviewsPosted = new List<CustomerReviewModel>();
            this.appointmentsMade = new List<CustomerAppointmentViewModel>();

            foreach (var review in reviews)
            {
                this.reviewsPosted.Add(new CustomerReviewModel(review));
            }

            foreach (var appointment in appointments)
            {
                this.appointmentsMade.Add(new CustomerAppointmentViewModel(appointment));
            }
        }
        public async Task<IHttpActionResult> RegisterCustomer(RegisterCustomerBindingModel model)
        {
            if (model== null)
            {
                return this.BadRequest("Invalid user data");
            }
            if (!this.ModelState.IsValid)
            {
                return this.BadRequest(this.ModelState);
            }

            var user = new Customer()
            {
                UserName = model.Username,
                Email = model.Email,
                PhoneNumber = model.PhoneNumber,
                Gender = (Gender)Enum.Parse(typeof(Gender), model.Gender, true),
                IsDeleted = false
            };

            IdentityResult result = await this.UserManager.CreateAsync(user, model.Password);

            if (!result.Succeeded)
            {
                return this.GetErrorResult(result);
            }

            var newUser = this.EscortServiceData.Users.FirstOrDefault(u => u.UserName == user.UserName);

            if (newUser != null)
            {
                var roleUser = this.UserManager.AddToRole(newUser.Id, "customer");
            }

            //Auto login after registration (successful user registration should return access_token)
            //var loginResult = await this.LoginUser(new UserAccountInputModel()
            //{
            //    Username = model.Username,
            //    Password = model.Password
            //});

            //return loginResult;

            return this.Ok();
        }