public void UpdateProfile(ProfileEntity profile)
        {
            if (profile.Role != "0")
            {
                userRepository.AddRoleToUser(roleRepository.GetByPredicate(r => r.Name == profile.Role),
                                             userRepository.GetById(profile.Id));
                uow.Commit();
            }
            var dalProfile = profileRepository.GetById(profile.Id);

            dalProfile.DalAreas = new HashSet <DalArea>();
            if (profile.Role != "Manager")
            {
                foreach (var area in profile.AreaEntities)
                {
                    var dalArea = areaRepository.GetByPredicate(x => x.Name == area);
                    if (dalArea == null)
                    {
                        areaRepository.Create(new DalArea()
                        {
                            Name = area
                        });
                        uow.Commit();
                        profileRepository.AddAreaToProfile(dalProfile,
                                                           areaRepository.GetByPredicate(x => x.Name == area));
                    }
                    else
                    {
                        profileRepository.AddAreaToProfile(dalProfile, dalArea);
                    }
                }
            }
            profile.Id           = dalProfile.Id;
            profile.AreaEntities = new HashSet <string>();
            profileRepository.Update(profile.ToDalProfile());
            uow.Commit();
        }