public async Task <IHttpActionResult> EditSourcePointAsync([FromBody] SourcePointForm sourcePointAdded) { if (!ModelState.IsValid) { return(BadRequest("Invalid posted data.")); } try { var sourcePoint = _mapper.Map <SourcePoint>(sourcePointAdded); return(Ok(await _sourceService.EditSourcePointAsync(sourcePointAdded.GroupIds != null ? sourcePointAdded.GroupIds : new int[] { }, sourcePoint))); } catch (Exception ex) { return(BadRequest(ex.ToString())); } }