public bool AddProfile(ProfileModel profileModel)
        {
            Profile profile = new Profile();

            AutoMapper.Mapper.Map(profileModel, profile);
            bool isExists = profileRepository.Exists(r => r.ProfileName == profileModel.ProfileName && (r.CompanyId == profileModel.CompanyId || profileModel.CompanyId == null) && r.RecordDeleted == false);

            if (!isExists)
            {
                List <ProfilePermission> defaultPermissions = profilePermissionRepository.GetAll(x => x.Profile.IsDefaultForRegisterdUser == true).ToList();
                foreach (ProfilePermission profilePermission in defaultPermissions)
                {
                    profile.ProfilePermissions.Add(new ProfilePermission()
                    {
                        HasAccess          = profilePermission.HasAccess,
                        CreatedDate        = DateTime.UtcNow,
                        ModulePermissionId = profilePermission.ModulePermissionId,
                        CreatedBy          = profileModel.CreatedBy
                    });
                }
                profileRepository.Insert(profile);
                return(true);
            }
            else
            {
                return(false);
            }
        }