public Community Add(Community community)
{
try
{
var checkCommunity = IsCommunityNameInUse(community.Name);
if (checkCommunity)
{
return new Community().GenerateError<Community>((int)Constants.Error.ValidationError,
string.Format("Community name {0} is already in use.", community.Name));
}
community.Members = new List<User>();
community.Members.Add(community.Leader);
return CommunityMapper.ToDto(_communityRepository.Add(CommunityMapper.ToEntity(community)));
}
catch (Exception ex)
{
throw new BlogException(ex.Message, ex.InnerException);
}
}