public async Task <IHttpActionResult> Delete([FromUri] int id) { var tenant = _tenantsRepository.GetById(id); var preview = tenant?.Preview; if (preview == null) { return(NotFound()); } _tenantsRepository.DeletePreviewFile(entitiId: id); _tenantsRepository.SaveChanges(); return(StatusCode(HttpStatusCode.NoContent)); }