public Task <ResponseViewModel <List <VacationDataViewModel> > > DeleteVacationAsync(List <VacationDataViewModel> vacations, LoginViewModel loggedUser)
        {
            return(Task.Factory.StartNew(() =>
            {
                var response = new ResponseViewModel <List <VacationDataViewModel> >();

                response = _validator.IsValidForDelete(vacations, loggedUser);
                if (!response.Success)
                {
                    return response;
                }

                try
                {
                    foreach (var vacation in vacations)
                    {
                        var vacationToDelete = _context.VacationData
                                               .SingleOrDefault(c => c.ID == vacation.Id);

                        if (vacationToDelete == null)
                        {
                            throw new Exception(string.Format("Meanwhile the vacation was deleted by another user!"));
                        }

                        _context.VacationData.Remove(_context.VacationData.Find(vacation.Id));
                    }

                    _context.SaveChanges();

                    response.Success = true;
                    response.ResponseMessages.Add(ApplicationConstants.DELETE_SUCCESS);
                    response.ReturnedObject = GetVacationForUser(vacations.FirstOrDefault().CalendarDate.Year,
                                                                 vacations.FirstOrDefault().CalendarDate.Month,
                                                                 null,
                                                                 vacations.FirstOrDefault().UserID);
                    return response;
                }
                catch (Exception e)
                {
                    response.Success = false;
                    response.ResponseMessages.Add(ApplicationConstants.DELETE_ERROR + " - " + e.Message);
                    response.ReturnedObject = GetVacationForUser(vacations.FirstOrDefault().CalendarDate.Year,
                                                                 vacations.FirstOrDefault().CalendarDate.Month,
                                                                 null,
                                                                 vacations.FirstOrDefault().UserID);
                    return response;
                }
            }));
        }
        public Task <ResponseViewModel <UserViewModel> > DeleteUserDataAsync(int id, LoginViewModel loggedUser)
        {
            return(Task.Factory.StartNew(() =>
            {
                var response = new ResponseViewModel <UserViewModel>();

                response = _validator.IsValidForDelete(id, loggedUser);
                if (!response.Success)
                {
                    return response;
                }

                try
                {
                    var UserToDelete = _context.Users
                                       .SingleOrDefault(c => c.ID == id);

                    if (UserToDelete == null)
                    {
                        throw new Exception(string.Format("Meanwhile the user data was deleted by another user!"));
                    }

                    _context.Users.Remove(UserToDelete);

                    _context.SaveChanges();

                    response.Success = true;
                    response.ResponseMessages.Add(ApplicationConstants.DELETE_SUCCESS);

                    return response;
                }
                catch (Exception e)
                {
                    response.Success = false;
                    response.ResponseMessages.Add(ApplicationConstants.DELETE_ERROR + " - " + e.Message);

                    return response;
                }
            }));
        }