public async Task <ProcessResult <bool> > RemovePhoto(RemovePhotoViewModel viewModel)
        {
            ProcessResult <bool> result = new ProcessResult <bool>();

            ProcessResult <bool> categoryStatus = await CategoryIsInRequiredStatus(viewModel.CategoryId, CategoryStatusCodes.SubmittingPhotos);

            if (!categoryStatus.Success)
            {
                result.AddError(categoryStatus.ErrorMessage);
            }

            if (result.Success)
            {
                Photograph photo = await _db.Photographs
                                   .FirstOrDefaultAsync(p =>
                                                        p.Category.CategoryId == viewModel.CategoryId &&
                                                        p.UserCategoryPhotoNumber == viewModel.PhotoNumber &&
                                                        p.Photographer.UserName == User.Identity.Name);

                if (photo != null)
                {
                    result = _db.SaveRemoves(photo);
                }
                else
                {
                    result.AddError("Unable to find a photo with these details");
                }
            }

            return(result);
        }
        public async Task <IActionResult> Delete(DeleteCategoryViewModel viewModel)
        {
            ProcessResult <PhotoCategory> categoryProcessResult = await GetPhotoCategory(viewModel.CategoryId);

            ModelState.AddProcessResultErrors(categoryProcessResult);
            if (ModelState.IsValid)
            {
                ProcessResult <bool> saveResult = _db.SaveRemoves(categoryProcessResult.Result);
                ModelState.AddProcessResultErrors(saveResult);
            }

            if (ModelState.IsValid)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(viewModel));
            }
        }