public IServiceResults<int> Add(UserInClass model)
 {
     if (IsUniqueUserInClass((Guid)model.UserId, model.ClassId))
         return new ServiceResults<int>
         {
             IsSuccessfull = false,
             Message = BusinessMessage.RecordExist,
             Result = 0
         };
     model.Rebind();
     if (_classService.FindClass(model.ClassId)?.Capacity <= GetUserCountInClass(model.ClassId))
     {
         return new ServiceResults<int>
         {
             IsSuccessfull = false,
             Message = BusinessMessage.CapacityIsFull,
             Result = 0
         };
     }
     _userInClass.Add(model);
     var saveResult = _uow.SaveChanges();
     return new ServiceResults<int>
     {
         IsSuccessfull = saveResult.ToBool(),
         Message = saveResult.ToMessage(BusinessMessage.Error),
         Result = model.UserInClassId
     };
 }
 public IServiceResults<bool> Edit(UserInClass model)
 {
     model.Rebind();
     _userInClass.Attach(model);
     _uow.Entry<UserInClass>(model).State = EntityState.Modified;
     var result = _uow.SaveChanges();
     return new ServiceResults<bool>()
     {
         IsSuccessfull = result.ToBool(),
         Message = result.ToMessage(BusinessMessage.Error),
         Result = result.ToBool()
     };
 }