// GET: Group
        public ActionResult Index()
        {
            var modelRequest = groupDataService.GetGroupsWithDetails(new DataRequest { Count = 100, StartPosition = 0 });
               IEnumerable<GroupViewModel> model =new GroupViewModel[0];
               if (modelRequest.state == StatusState.DoneState)
            {
                TaskResult<IEnumerable<int>> getGroupTask = groupDataService.GetUserGroups(UserDetails.Id.Value);
                if (getGroupTask.state == StatusState.DoneState)
                {
                    if (getGroupTask.Data != null)
                    {
                        ViewBag.UserGroups = getGroupTask.Data.ToList();
                    }
                    else
                    {
                        ViewBag.UserGroups = new List<int>();
                    }
                }
                else//error handle
                {

                }
                model = modelRequest.Data.Select(a => a.ConvertToGroupViewModel()).AsEnumerable();
            }

              return View(model);
        }
        public ActionResult Create(GroupViewModel saveViewModel)
        {
            if(ModelState.IsValid)
            {
                groupDataService.CreateGroup(saveViewModel.ConvertToGroupDetail());
            }
            else
            {
                return View();
            }

            return RedirectToAction("Index");
        }
 public static GroupDetail ConvertToGroupDetail(this GroupViewModel model)
 {
     return(new GroupDetail {
         Description = model.Description, Id = model.Id, Name = model.Name, NumberOfMembers = model.NumberOfMembers, NumberOfStories = model.NumberOfStories
     });
 }