public async Task <IActionResult> ShareVideo(VideoSettingsViewModel model)
        {
            ViewData["Id"] = model.UserId;

            AppUser user = await userManager.FindByIdAsync(model.UserId);

            if (user != null)
            {
                Video video = repository.Videos.FirstOrDefault(v => v.Id == model.VideoId);

                if (model.UsersIds != null && model.UsersIds.Trim() != "")
                {
                    //list of users id
                    string userIdList = model.UsersIds.Trim();
                    while (userIdList.Trim().Length > 0)
                    {
                        int index = userIdList.IndexOf(";");
                        if (index != -1)
                        {
                            string newUserId = userIdList.Substring(0, index);

                            repository.SaveVideoShared(video.Id, newUserId);

                            userIdList = userIdList.Replace(newUserId + ";", "");
                        }
                    }
                }
                return(RedirectToAction("VideoSettings", new { id = model.UserId, videoId = model.VideoId }));
            }

            return(RedirectToAction("Error", "UserNotFound"));
        }