Inheritance: BaseDto
        public bool UpdateUser(UserDto dto)
        {
            var user = this.db.Users.FirstOrDefault(x => x.DeletedOn.HasValue == false && x.Id == dto.Id);
            if (user != null)
            {
                user.AffiliateSlug = dto.AffiliateSlug;
                user.Birthday = dto.Birthday;
                user.Email = dto.Email;
                user.FacebookId = dto.FacebookId;
                user.FirstName = dto.FirstName;
                user.GenderId = dto.Gender.Id;
                user.IdentityNumber = dto.IdentityNumber;
                user.IsActive = dto.IsActive;
                user.IsMailingActive = dto.IsMailingActive;
                user.IsOtherMailingActive = dto.IsOtherMailingActive;
                user.LastInvoiceAddressId = dto.LastInvoiceAddressId;
                user.LastName = dto.LastName;
                user.LastShippingAddressId = dto.LastShippingAddressId;
                user.Names = dto.Names;
                user.PasswordHash = dto.PasswordHash;
                user.PhotoUrl = dto.PhotoUrl;
                user.PinterestId = dto.PinterestId;
                user.Point = dto.Point;
                user.PreferredName = dto.PreferredName;
                user.RefererSource = dto.RefererSource;
                user.Website = dto.Website;
                user.TwitterId = dto.TwitterId;
                user.VirtualMoney = dto.VirtualMoney;
                user.UserTypeId = dto.UserType.Id;
                user.SkypeId = dto.SkypeId;

                user.Comment = dto.Comment;
                user.UpdatedOn = DateTime.Now;
                user.UpdatedBy = dto.UpdatedBy;

                this.db.SaveChanges();

                this.UserLoginDictionary.AddOrUpdate(user.Email, user.PasswordHash, (k, v) => user.PasswordHash);

                var userDto = Mapper.Map<User, UserDto>(user);
                this.UserDictionary.AddOrUpdate(user.Email, userDto, (k, v) => userDto);

                return true;
            }

            return false;
        }
        public int CreateUser(UserDto dto)
        {
            if (!DoesUserEmailExists(dto.Email))
            {
                var gender = db.Genders.First(x => x.Id == dto.Gender.Id);
                var userType = db.UserTypes.First(x => x.Id == dto.UserType.Id);

                db.Users.Add(new User
                                 {
                                     CreatedOn = DateTime.Now,
                                     UpdatedOn = DateTime.Now,
                                     LastUpdatedBy = 1,
                                     IsActive = true,
                                     IsMailingActive = true,
                                     IsOtherMailingActive = true,
                                     Names = dto.Names,
                                     FirstName = dto.FirstName,
                                     LastName = dto.LastName,
                                     PreferredName = dto.PreferredName,
                                     Email = dto.Email,
                                     PasswordHash = dto.PasswordHash,
                                     RefererSource = dto.RefererSource,
                                     Gender = gender,
                                     UserType = userType,
                                     Point = 0,
                                     VirtualMoney = 0,
                                     Birthday = dto.Birthday,
                                     PhotoUrl = dto.PhotoUrl,
                                     TwitterId = dto.TwitterId,
                                     FacebookId = dto.FacebookId,
                                     Website = dto.Website,
                                     IdentityNumber = dto.IdentityNumber,
                                     AffiliateSlug = dto.AffiliateSlug
                                 });
                db.SaveChanges();

                var user = db.Users.FirstOrDefault(x => x.Email == dto.Email);
                if (user != null)
                {
                    _lockUserLoginDictionary.EnterWriteLock();
                    UserLoginDictionary.Add(user.Email, user.PasswordHash);
                    _lockUserLoginDictionary.ExitWriteLock();

                    var userDto = _userAssembler.Assemble(user);

                    _lockUserDictionary.EnterWriteLock();
                    UserDictionary.Add(user.Email, userDto);
                    _lockUserDictionary.ExitWriteLock();

                    return user.Id;
                }
            }

            return 0;
        }
        /// <summary>
        /// The create user.
        /// </summary>
        /// <param name="dto">
        /// The userDto.
        /// </param>
        /// <returns>
        /// The System.Int32 userId.
        /// </returns>
        public int CreateUser(UserDto dto)
        {
            if (!this.DoesUserEmailExists(dto.Email))
            {
                this.db.Users.Add(new User
                                 {
                                     CreatedOn = DateTime.Now,
                                     UpdatedOn = DateTime.Now,
                                     UpdatedBy = 1,
                                     Comment = dto.Comment,
                                     IsActive = true,
                                     IsMailingActive = true,
                                     IsOtherMailingActive = true,
                                     Names = dto.Names,
                                     FirstName = dto.FirstName,
                                     LastName = dto.LastName,
                                     PreferredName = dto.PreferredName,
                                     Email = dto.Email,
                                     PasswordHash = dto.PasswordHash,
                                     RefererSource = dto.RefererSource,
                                     GenderId = dto.Gender.Id,
                                     UserTypeId = dto.UserType.Id,
                                     Point = 0,
                                     VirtualMoney = 0,
                                     Birthday = dto.Birthday,
                                     PhotoUrl = dto.PhotoUrl,
                                     TwitterId = dto.TwitterId,
                                     FacebookId = dto.FacebookId,
                                     Website = dto.Website,
                                     IdentityNumber = dto.IdentityNumber,
                                     AffiliateSlug = dto.AffiliateSlug

                                 });
                this.db.SaveChanges();

                var user = this.db.Users.FirstOrDefault(x => x.Email == dto.Email);
                if (user != null)
                {
                    this.UserLoginDictionary.TryAdd(user.Email, user.PasswordHash);

                    var userDto = Mapper.Map<User, UserDto>(user);
                    this.UserDictionary.TryAdd(user.Email, userDto);

                    return user.Id;
                }
            }

            return 0;
        }